[英]How to reset the Navigation Controller in Xcode 6?
Im working on an App for iOS, thats uses the navigationController to switch betweens views. 我正在为iOS应用开发应用程序,那就是使用navigationController在视图之间切换。 I'm trying to return from to the root viewcontroller from the third view.
我试图从第三个视图返回到根viewcontroller。
I have succeeded in the Main.Storyboard, with dragging a button from third to root view, but then the NavigationController just continues the stack. 我已经成功完成了Main.Storyboard,将按钮从第三个视图拖到了根视图,但是NavigationController只是继续执行堆栈。
Is it possible to make a command from third view, to return to root ViewController, without the NavigationController Bar showing the "Back" button and keeping track and without reseting any Bools. 是否可以从第三个视图发出命令,以返回到根ViewController,而NavigationController栏不显示“后退”按钮并保持跟踪,并且不重置任何Bool。
您可以使用[UINavigationCobtroller popToRootViewControllerAnimated:]
将所有视图层次结构关闭到第一个,但对于其余问题,您可以在SO上找到很多答案。
If you want to hide the back button from the navigation bar.Then write the code in third view's viewDidLoad or in viewWillAppear- 如果您要隐藏导航栏中的后退按钮,请在第三个视图的viewDidLoad或viewWillAppear-
self.navigationItem.hidesBackButton=YES;
And Now write the code in the body of the action button.Such as- 然后在操作按钮的主体中编写代码。
[self.navigationController popToRootViewControllerAnimated:YES];
Let me know if it works for you.Thank you 让我知道它是否对您有用。谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.