HeroTransitions / Hero

Elegant transition library for iOS & tvOS
https://HeroTransitions.github.io/Hero/
MIT License
22.02k stars 1.72k forks source link

UIViews losing their backgroundColor during transition #670

Open logananderson opened 4 years ago

logananderson commented 4 years ago

What did you do?

In my project, there are a series of UIViewControllers that all share a common background UIImageView. Using Hero, I set navigationController?.hero.isEnabled = true. Then I set the heroId of the imageView that contains the same image from each ViewController.

self.bgImageView.hero.id = "bgImageView"
nextVc.bgImageView.hero.id = "bgImageView"

I then call pushViewController

What did you expect to happen?

I would expect the background image to persist during the transition, but for the other elements to be replaced in the slide animation.

What happened instead?

This does happen, however UIViews that have their backgroundColor set lose their backgroundColor and become clear during the transition.

heroIssue

If I remove the hero identifiers on the background imageView, the UIButton and UITextField's act as expected, retaining their backgroundColor.

General Information

Demo Project

https://github.com/logananderson/HeroIssueExample

aspek commented 4 years ago

Did you set hero.isEnabled = true at targetViewController?

logananderson commented 4 years ago

I did. Sorry my example repo was pointing to the wrong code. I pushed the right project.

https://github.com/logananderson/HeroIssueExample/blob/master/HeroImageIssue/ViewController.swift#L27

I set hero.isEnabled = true on the navigation controller, current viewcontroller, and the one being pushed.

GitHub
logananderson/HeroIssueExample
Contribute to logananderson/HeroIssueExample development by creating an account on GitHub.