popToViewController用法

作者: iOS 发布时间: 2021-04-02 浏览: 1927 次 编辑

popToViewController用法


方法一

[self.navigationController popToViewController:[self.navigationController.viewControllers
         objectAtIndex:([self.navigationController.viewControllers count] -2)] animated:YES];

方法二

for (UIViewController *temp in self.navigationController.viewControllers) {
           if ([temp isKindOfClass:[你要跳转到的Controller class]]) {
              [self.navigationController popToViewController:temp animated:YES];
           }
 }