是否可以两次弹出 UINavigationController? [英] Is it possible to pop the UINavigationController twice?
问题描述
是否可以两次弹出导航控制器?我有这个导航结构:
Is it possible to pop the navigation controller twice? I have this navigation structure:
看一---->看二---->看三
View One ----> View Two -----> View Three
我想要完成的是,通过点击视图三上的一行,直接返回到视图一.我已经通过协议委托从三到二完成了它,但是在视图一中设置委托不起作用并且设置两个连续的委托协议都弹出导航控制器,给我错误:嵌套导航控制器活动(或类似的东西)).
What I'd like to accomplish is that by the tap of a row on View Three, go back directly to View One. I've done it from Three to Two via protocol-delegate, but setting the delegate in view One doesn't work and setting two consecutive delegate-protocol both poping the navigation controller, gives me error: nested navigation controller activity (or something similar).
任何帮助将不胜感激.提前致谢!
Any help would be appreciated. Thanks in advance!
推荐答案
有几个弹出选项
- (UIViewController *)popViewControllerAnimated:(BOOL)animated
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated
- 第一个弹出顶部控制器.
- 第二个允许您弹出整个堆栈以到达根.
- 第三个允许您弹出到您引用的任何视图控制器.您可以使用
self.navigationController.viewControllers
获取 viewController,然后使用该数组获取您想要弹出的特定 viewController - The first pops the top controller.
- The second allows you to pop the whole stack off to get to the root.
- The third allows you to pop to any viewController you have a reference to. You can get the viewController with
self.navigationController.viewControllers
and then work with the array to get the specific viewController you want to pop to
这篇关于是否可以两次弹出 UINavigationController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!