1. iOS返回跳到指定控制器
// 返回指定控制器
for (UIViewController *controller in self.navigationController.viewControllers) {
if ([controller isKindOfClass:[InboxViewController class]]) {
[self.navigationController popToViewController:controller animated:YES];
}
}
2. 移除指定控制器
方法a:
NSArray* tempVCA = [self.navigationController viewControllers];
for(UIViewController *tempVC in tempVCA)
{
if([tempVC isKindOfClass:[urViewControllerClass class]])
{
[tempVC removeFromParentViewController];
}
}
方法b:
NSMutableArray *navigationArray = [[NSMutableArray alloc] initWithArray: self.navigationController.viewControllers];
[navigationArray removeObjectAtIndex: 2];
self.navigationController.viewControllers = navigationArray;
网友评论