使用presentViewController跳转到上上个页面,实现多层跳转的两种方法。
2015-10-09 21:38
561 查看
第一种方法
简单容易实现。
[self.presentingViewController.presentingViewController.presentingViewController
dismissViewControllerAnimated:NO
completion:nil];
一定要是no才行。
第2种方法:
转自http://blog.csdn.net/xiaofansong/article/details/8011557
pushViewController/presentModalViewController/addSubView区别及使用方法 - 一件飘雪 - 博客频道 - CSDN.NET
使用presentModalViewControllerAnimated方法从A->B->C,若想在C中直接返回A,则可这样实现:
C中返回事件:
void back
{
[self dismissModalViewControllerAnimated:NO];//注意一定是NO!!
[[NSNotificationCenter defaultCenter]postNotificationName:@"backback" object:nil];
}
然后在B中,
//在viewdidload中:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(back) name:@"backback" object:nil];
-(void)back
{
[self dismissModalViewControllerAnimated:YES];
}
第二种方法 [self.presentingViewController.presentingViewController.presentingViewController dismissViewControllerAnimated:NO completion:nil]; 一定要是no才行。
简单容易实现。
[self.presentingViewController.presentingViewController.presentingViewController
dismissViewControllerAnimated:NO
completion:nil];
一定要是no才行。
第2种方法:
转自http://blog.csdn.net/xiaofansong/article/details/8011557
pushViewController/presentModalViewController/addSubView区别及使用方法 - 一件飘雪 - 博客频道 - CSDN.NET
使用presentModalViewControllerAnimated方法从A->B->C,若想在C中直接返回A,则可这样实现:
C中返回事件:
void back
{
[self dismissModalViewControllerAnimated:NO];//注意一定是NO!!
[[NSNotificationCenter defaultCenter]postNotificationName:@"backback" object:nil];
}
然后在B中,
//在viewdidload中:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(back) name:@"backback" object:nil];
-(void)back
{
[self dismissModalViewControllerAnimated:YES];
}
第二种方法 [self.presentingViewController.presentingViewController.presentingViewController dismissViewControllerAnimated:NO completion:nil]; 一定要是no才行。
相关文章推荐
- SWF逆向之AnyGantt 去水印
- 又是一个第一次,随便写点什么吧。
- matlab 画框(三) 画框并保存图像
- win764 QTCreator2.8.0+Qt Open source 4.8.5环境配置(Win7x64)
- HDU 1495 非常可乐(BFS)
- kafka教程
- 十一返乡行
- 【C#】listview应用
- C#网线程里传参数的方法总结
- JS数组方法汇总 ARRAY数组元素的添加和删除
- free books site
- Scalaz(8)- typeclass:Monoid and Foldable
- Codeforces Round #323(div2) 583B. Robot's Task
- 软件测试心理学
- NODE.JS玩玩
- php报错:Strict Standards: Only variables should be passed by reference in...
- linux中解压rar文件
- [TYVJ 1288] 飘飘乎居士取能量块
- PHP第一季视频教程.李炎恢.学习笔记(二)(第2章 基本语法(1))
- HDU1181——变形课(dfs)