简体   繁体   English

如何在Xcode 6中重置导航控制器?

[英]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.

相关问题 Xcode中的导航控制器 - Navigation Controller in Xcode 如何将导航控制器用作UIWebView [Xcode]的导航? - How to use the Navigation Controller as a Navigation for my UIWebView [Xcode]? 如何终止导航控制器并将不同的视图嵌入到不同的导航控制器中?-Swift / Xcode - How to terminate a navigation controller and embed different views in a different navigation controller?-Swift/Xcode iOS:Xcode 4.2和导航控制器 - iOS: Xcode 4.2 and Navigation Controller 如何在带有导航控制器的ios xcode4.5中使用SEGUE - how to use SEGUE in ios xcode4.5 with navigation controller 在Xcode 10中设计视图控制器后,如何添加导航控制器? - How to add navigation controller after designing the viewcontroller in Xcode 10? 在视图中重置导航栏的外观 controller - Reset the appearance of navigation bar in a view controller Xcode Swift-如何从拆分控制器转到特定的导航视图控制器 - Xcode Swift - How to go to specific navigation view controller from split controller 如何在Swift Xcode 8.2中以编程方式将导航控制器嵌入到选项卡栏控制器中? - How can I embed my navigation controller into my tab bar controller programmatically in Swift Xcode 8.2? 从Xcode的主控制器中删除导航栏? - Remove navigation bar from main controller in Xcode?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM