在之前用的presentViewcontroller用的比较多,但是解除了NavigationController之后看了下里面的方法,也有过看过里面的方法呀,
比如返回上一级的界面:[self.navigationController popViewControllerAnimated:YES];
返回的主界面的:[self.navigationController popToRootViewControllerAnimated:YES];
跳转到指定的界面:
NewConfigViewController *homeVC = [[NewConfigViewController 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]; //跳转
}
时间: 2024-11-04 11:59:36