Navigation stack will not be updated, segue from GMSAutocompleteResultsViewController

守給你的承諾、 提交于 2019-12-24 20:44:55

问题


I'm having issue with segue to the existing UIViewcontroller via the pushViewController.

When I'm tap on the place in resultsViewController, I expect the segue to the MainVC, but i have an error:

pushViewController:animated: called on while an existing transition or presentation is occurring; the navigation stack will not be updated.

How can I fix this, and have the transition to MainVC??


回答1:


Couple things:

  1. Make sure you are not "doubling up" on navigation. If you use a Segue to transition to another view controller, do not also call .pushViewController() or present().

  2. Understand the difference between push and present.

In your case, it appears (based on your description and your screenshot) that MainVC is the root VC of your NavController, and a Segue has pushed SearchVC onto the navigation stack. If SearchVC "slides in from the right" that is almost certainly the case.

If you have pushed a VC onto the Nav Stack, then you want to pop it off the stack with popViewController(animated: Bool). That will "slide the previous VC back in from the left".

In your goToVc() function, you are creating a new instance of MainVC and trying to push it onto the stack.



来源:https://stackoverflow.com/questions/47618472/navigation-stack-will-not-be-updated-segue-from-gmsautocompleteresultsviewcontr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!