ios navigationController中界面跳转 :X–> A–>B–>C 返回 C–>A
2017-04-23 19:16
429 查看
navigationController中界面进入时层次关系是 X–>A–>B–>C 返回 时要求 C直接跳转至A
2种解决方案:
1、在C中写个指针,指向A,使用方法popToViewController直接调至A
本人不喜欢指针传来传去,寻求良友找到另一种解决方案
2、在C中,将navigationController的Views队列中的B删除,然后
popViewControllerAnimated,就可以直接返回到A了
代码如下:
1.
NSMutableArray*viewsArray = [NSMutableArrayarrayWithArray:[self.navigationControllerviewControllers]];
2.
[viewsArray removeObjectAtIndex:[viewsArray count]-2];
3.
[self.navigationControllersetViewControllers:[NSArrayarrayWithArray:viewsArray]];
4.
[self.navigationControllerpopViewControllerAnimated:YES];
这种方法,我自己觉得,很简洁 方便,而且有助于我们对于navigationController的机制的理解
3、此外,如果想直接从C–>X,可以直接使用方法
popToRootViewControllerAnimated
大家有其他解决方法,可以共享下~
原文链接:http://www.comedreams.com/index.PHP/archives/37483
2种解决方案:
1、在C中写个指针,指向A,使用方法popToViewController直接调至A
本人不喜欢指针传来传去,寻求良友找到另一种解决方案
2、在C中,将navigationController的Views队列中的B删除,然后
popViewControllerAnimated,就可以直接返回到A了
代码如下:
1.
NSMutableArray*viewsArray = [NSMutableArrayarrayWithArray:[self.navigationControllerviewControllers]];
2.
[viewsArray removeObjectAtIndex:[viewsArray count]-2];
3.
[self.navigationControllersetViewControllers:[NSArrayarrayWithArray:viewsArray]];
4.
[self.navigationControllerpopViewControllerAnimated:YES];
这种方法,我自己觉得,很简洁 方便,而且有助于我们对于navigationController的机制的理解
3、此外,如果想直接从C–>X,可以直接使用方法
popToRootViewControllerAnimated
大家有其他解决方法,可以共享下~
原文链接:http://www.comedreams.com/index.PHP/archives/37483
相关文章推荐
- ios navigationController中界面跳转 :X–> A–>B–>C 返回 C–>A
- ios navigationController中界面跳转 :X–> A–>B–>C 返回 C–>A
- ios navigationController中界面跳转 :X–> A–>B–>C 返回 C–>A
- ios--NavigationViewController跳转、返回传值
- ios--NavigationViewController跳转、返回传值
- ios开发navigationController pushViewController 方式多次跳转 怎么返回到最上层,怎么返回到指定的某一层
- ios开发navigationController pushViewController 方式多次跳转 怎么返回到最上层,怎么返回到指定的某一层
- ios--NavigationViewController跳转、返回传值
- ios开发navigationController pushViewController 方式多次跳转返回到最上层返回到指定的某一层的实现方法
- ios NavigationViewController跳转以及返回传值
- ios--NavigationViewController跳转、返回传值
- navigationController pushViewController 多次跳转后怎么返回
- iOS ViewController跳转界面的几种方法简单总结
- IOS tabBarController 嵌套navigationController 实现多个界面的跳转
- ios--NavigationViewController返回并刷新UITableView页面
- ios--NavigationViewController返回并刷新UITableView页面
- navigationController pushViewController 多次跳转后怎么返回
- iOS viewController添加导航条以及返回跳转选择
- navigationController pushViewController 多次跳转后怎么返回
- navigationController pushViewController 多次复杂跳转后怎么返回