popToViewController的用法
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:2]
animated:YES];
还有一种:
for (UIViewController *temp in self.navigationController.viewControllers) {
if ([temp isKindOfClass:[你要跳转到的Controller class]]) {
[self.navigationController popToViewController:temp animated:YES];
}
}
关闭所有
//关闭所有的ViewController
-(void)dismissModalStack {
UIViewController *vc = self.presentingViewController;
while (vc.presentingViewController) {
vc = vc.presentingViewController;
}
[vc dismissViewControllerAnimated:YES completion:NULL];
}