如何回到一个视图在UINavigationController? [英] How to go back one view in UINavigationController?
问题描述
是否有一个方法来返回一个视图在堆栈中 UINavigationController
?或者到具有特定标题的视图?
Is there a method to go back one view in the stack on a UINavigationController
? Or to a view with a specific title?
推荐答案
我不是说粗鲁, google搜索,甚至苹果文档搜索UINavigationController将会得到你所需要的。要以编程方式弹出您使用的当前视图控制器:
I don't mean to be rude, but this is really well documented. A google search or even an Apple documentation search on UINavigationController will turn up exactly what you need. To programmatically pop the current view controller you use:
[[self navigationController] popViewControllerAnimated:YES];
要弹出到特定视图控制器,请使用:
To pop to a specific view controller, you use:
[[self navigationController] popToViewController:controller animated:YES];
你必须先遍历视图控制器列表,寻找并传递给这个方法。
You will have to iterate through the list of view controllers first and check the title against what you're looking for and pass that to this method.
这篇关于如何回到一个视图在UINavigationController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!