获取navigationController中的控制器

@implementation UIViewController (UIViewControllerExt)

- (void)popViewController:(NSString *)controllerStr
{
    for (UIViewController *vc in self.navigationController.viewControllers) {
        if ([vc isKindOfClass:[NSClassFromString(controllerStr) class]]) {
            [self.navigationController popToViewController:vc animated:YES];
            
        }
    }
}

 

posted @ 2018-04-03 23:53  码出境界  阅读(740)  评论(0编辑  收藏  举报