判断UIViewController返回时使用 pop 的方法,还是使用dismiss 的方法了。
- (void)backAction {
NSLog(@"presentingViewController = %@", self.presentingViewController);
NSLog(@"self.navigationController.topViewController = %@", self.navigationController.topViewController);
NSLog(@"self.navigationController.viewControllers.count = %ld", self.navigationController.viewControllers.count);
if (self.presentingViewController) {
[self dismissViewControllerAnimated:YES completion:nil];
} else if (self.navigationController.viewControllers.count > 2 || self.navigationController.topViewController == self) {
[self.navigationController popViewControllerAnimated:YES];
}
}
网友评论