當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.'
壓入棧了,在棧內查找