+ (void)removeController:(UIViewController *)vc {
NSArray* tempVCA = [vc.navigationController viewControllers];
for(UIViewController *tempVC in tempVCA) {
if([tempVC isKindOfClass:[vc class]]) {
[tempVC removeFromParentViewController];
}
}
}
removeFromParentViewController 這個(gè)方法會(huì)有一些問題,雖然將控制器移除了,但是返回的依然是這個(gè)控制器的導(dǎo)航欄
所以采用,break要加,因?yàn)椴患涌赡軙?huì)有些問題
+ (void)removeController:(UIViewController *)vc {
NSMutableArray* tempVCA = [NSMutableArray arrayWithArray:[vc.navigationController viewControllers]];
for(UIViewController *tempVC in tempVCA) {
if([tempVC isKindOfClass:[vc class]]) {
[tempVCA removeObject:tempVC];
break;
}
}
vc.navigationController.viewControllers = tempVCA;
}