Hero icon indicating copy to clipboard operation
Hero copied to clipboard

From simple VC to VC as root of NavigationController

Open jpv123 opened this issue 8 years ago • 4 comments

Hi, I can't find how can I make a simple transition with a navigationController in the middle of two VCs:

  • I have a "firstVC" who is not part of a NavigationController
  • This VC performs a segue to a navigation controller who has a "secondVC" as root
  • In my "firstVC" I have an UIImageView with heroId set to "logoImage"
  • In my "secondVC" I added a UIImageView to titleView property of the navigationItem
let image = UIImageView(image: UIImage(named: "logo")!)
image.heroID = "logoImage"
navigationItem.titleView = image

I set too navigationController.isHeroEnabled = true and the same property is set to true in my "firstVC" and "secondVC"

However when the segue is triggered, nothing happens. I'm not sure if I'm missing something

Thanks in advance

jpv123 avatar Jan 21 '18 00:01 jpv123

@jpv123: I have a similar issue. My VCs that contain the views that I want to animate are inside two different NavigationControllers: VC1 -> NavigationController (has VC2 as root) Would the transition only work for VCs that inside the same NavigationController?

andreipt avatar Feb 02 '18 22:02 andreipt

@andreipt Hi guys, I'm in the same case... i think it's a simple scenario!!! J

pjcau avatar Feb 05 '18 13:02 pjcau

@jpv123 Hi,

I resolved this to navigationController.isHeroEnabled = true for this case VC1 -> NavigationController (has VC2 as root).

Bye J

pjcau avatar Feb 05 '18 13:02 pjcau

@jpv123 Hi,

I resolved this to navigationController.isHeroEnabled = true for this case VC1 -> NavigationController (has VC2 as root).

Bye J

This recommendation works, I'm also using this setup for on my projects.

kuyazee avatar Nov 08 '19 14:11 kuyazee