Push到特定的Controller

来源:互联网 发布:共享的网络密码是多少 编辑:程序博客网 时间:2024/06/05 03:58

  方法一:

根据UIViewController在push中的Index:

   [self.navigationController popToViewController:

    [self.navigationController.viewControllers objectAtIndex:1] 

                                            animated:YES];

方法二:             

循环所有Controller,取出相应Controller:

        for (UIViewController *temp in self.navigationController.viewControllers) {

            if ([temp isKindOfClass:[MoreViewController class]]) {

                [self.navigationController popToViewController:temp animated:YES];

            }

        }