美文网首页
iOS pop 到指定界面

iOS pop 到指定界面

作者: 薄凉_简书 | 来源:发表于2017-04-01 14:49 被阅读259次

当A push 到 B,再push到 C,想从C pop 回A,有两种方法

1、pop到根视图控制器,没什么特别的

- (nullable UIViewController *)popViewControllerAnimated:(BOOL)animated; 

2、pop到指定控制器

- (nullable NSArray<__kindof UIViewController *> *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;

然而当我们直接用第二种方法时系统会“崩溃”,原因:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Tried to pop to a view controller that doesn't exist.'

压入栈了,在栈内查找

相关文章

网友评论

      本文标题:iOS pop 到指定界面

      本文链接:https://www.haomeiwen.com/subject/hneiottx.html