navigationController
1,跳转到指定的前面跳来的页面
UIViewController *target = nil;
for (UIViewController * controller in self.navigationController.viewControllers) { //遍历
if ([controller isKindOfClass:[controller1 class]]) {
target = controller;
}
else if([controller isKindOfClass:[controller2 class]])
{
target = controller;
}else if([controller isKindOfClass:[controller3 class]])
{
target = controller;
}
}
if (target) {
[self.navigationController popToViewController:target animated:YES]; //跳转
}`
2,跳转指定前面的没有跳过的页面
因为没有跳转过,所以需要创建
walletPage *homeVC = [[controller1 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]; //跳转
}
网友评论