pop到指定页面

话不多说直接上代码


 //跳转到指定页面
                
                    NewPayViewController *homeVC = [[NewPayViewController 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]; //跳转
                    }```

你可能感兴趣的:(pop到指定页面)