Hero: Cannot dismiss view using hero_dismissViewController()

Created on 31 May 2017  路  2Comments  路  Source: HeroTransitions/Hero

Hi!
I'm trying to push view controller using hero and it is amazing, my problem comes when i want to dismiss the view using hero_dismissViewController(), it just doesn't work. What I'm trying to do is the following:

VC[A] -> VC[B] Works
VC[B{backButton}] -> VC[A]

Here's the code:

VC[A] -> VC[B]
let nextController = storyboard?.instantiateViewController(withIdentifier: "EstablishmentDetailsViewController") as! EstablishmentDetailsViewController nextController.establishment = establishment // the following two lines configures the animation. default is .auto Hero.shared.setDefaultAnimationForNextTransition(.zoom) Hero.shared.setContainerColorForNextTransition(.white) hero_replaceViewController(with: nextController)

VC[B{backButton}] -> VC[A]
@IBAction func backButtonPressed(_ sender: UIButton) { hero_dismissViewController() }

Thanks in advance

question

Most helpful comment

Because you used hero_replaceViewController, your VC[A] doesn't exist any more. Just use present(VCB, animated: true, completion:nil) to present your VC[B] should solve your problem.

All 2 comments

Because you used hero_replaceViewController, your VC[A] doesn't exist any more. Just use present(VCB, animated: true, completion:nil) to present your VC[B] should solve your problem.

Cleaning Old Issues. Feel free to reopen.

Was this page helpful?
0 / 5 - 0 ratings