NavigationController 返回跳过视图 [英] NavigationController Back Skip View

查看:29
本文介绍了NavigationController 返回跳过视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我知道这个问题是以向前的方式提出的,但在这种情况下,我要求以一种向后的方式来设计导航控制器.话虽如此……

First off, I am aware of this question being asked in a forward manner, but in this case I am asking for a backwards manner in which the Navigation Controller is already designed. With that being said...

我有一个带有三个视图的 UINavigationController:TableGetAvail在 IB 中创建.

I have a UINavigationController with three views: Table, Get, and Avail in that order that was created in IB.

前进时,我想从 TableGet 再到 Avail,但是当我点击 Table 上的Back"按钮时code>Avail 我想跳过Get,直接回到Table.这可能吗?如果是这样,如何?

When going forward, I want to go from Table to Get to Avail, but when I hit the "Back" button on Avail I want to skip over Get and go directly back to Table. Is this possible? If so, how?

推荐答案

我是这样做的:

NSArray *VCs = [self.navigationController viewControllers];
[self.navigationController popToViewController:[VCs objectAtIndex:([VCs count] - 2)] animated:YES];

为了能够覆盖导航控制器的后退按钮,您必须继承 UINavigationController.查看本教程中的操作方法:http://www.hanspinckaers.com/custom-action-on-back-button-uinavigationcontroller

To be able to override the nav controllers's back button you're going to have to subclass UINavigationController. Check out how in this tutorial: http://www.hanspinckaers.com/custom-action-on-back-button-uinavigationcontroller

这篇关于NavigationController 返回跳过视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆