iOS开发 从UINavigationController中移除一个ViewController

    NSMutableArray *tmpArr = [NSMutableArray array];
    for (UIViewController *vc in self.navigationController.viewControllers) {
        [tmpArr addObject:vc];
    }
    for (UIViewController *vc in self.navigationController.viewControllers) {
        if (vc == self) {
            [tmpArr removeObject:vc];
        }
    }
    self.navigationController.viewControllers = tmpArr;

你可能感兴趣的:(iOS开发 从UINavigationController中移除一个ViewController)