第一种方法
简单容易实现。
[self.presentingViewController.presentingViewController.presentingViewController dismissViewControllerAnimated:NO completion:nil]; 一定要是no才行。
第2种方法:
pushViewController/presentModalViewController/addSubView区别及使用方法 - 一件飘雪 - 博客频道 - CSDN.NET
使用presentModalViewControllerAnimated方法从A->B->C,若想在C中直接返回A,则可这样实现:
- 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才行。