如何让self.navigationController退出到指定页面,或者让它一次性pop出两个页面popViewControllerAnimated没有

来源:互联网 发布:iphone6突然没有4g网络 编辑:程序博客网 时间:2024/05/17 14:29
HomeViewController:为你想要跳转的界面
HomeViewController *homeVC = [[HomeViewController alloc] init];

                  UIViewController *target = nil;

                  for (UIViewController * controller in self.navigationController.viewControllers) { //遍历

                      if ([controller isKindOfClass:[homeVC class]]) { //这里判断是否为你想要跳转的页面

                          target = controller;

                      }

                  }

                  if (target) {

                      [self.navigationController popToViewController:target animated:YES]; //跳转  

                  }