iOS中判断是从哪个控制器push进来的,返回指定控制器

2017-07-05  本文已影响0人  小的小碰撞
NSArray*arrController =self.navigationController.viewControllers;

NSIntegerVcCount = arrController.count;
UIViewController* back = nil;
    for(UIViewController* vc in self.navigationController.childViewControllers){
        if([vc isKindOfClass:[LegalPersonInformVC class]]){
            back = vc;
            break;
        }
    }
    
    if(back){
        [self.navigationController popToViewController:back animated:YES];
    } else {
        [self.navigationController popToRootViewControllerAnimated:YES];
    }
上一篇下一篇

猜你喜欢

热点阅读