1.栈里存在
for (UIViewController *vc in [self.navigationController viewControllers]) {
if ([vc isKindOfClass:[MonthlyExamDetailController class]]) {
[self.navigationController popToViewController:vc animated:YES];
}
}
2.栈里不存在
NSMutableArray*tempMarr =[NSMutableArray arrayWithArray:self.navigationController.viewControllers];
MonthlyExamDetailController *vc = [self.storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([MonthlyExamDetailController class])];
[tempMarr insertObject:vc atIndex:tempMarr.count- 1];
[self.navigationController setViewControllers:tempMarr animated:YES];
for (UIViewController *vc in [self.navigationController viewControllers]) {
if ([vc isKindOfClass:[MonthlyExamDetailController class]]) {
[self.navigationController popToViewController:vc animated:YES];
}
}
网友评论