UINavigationController *navigationVC = self.navigationController;
NSMutableArray *viewControllers = [[NSMutableArray alloc] init];
// 遍历导航控制器中的控制器
for (UIViewController *vc in navigationVC.viewControllers) {
// HSYPersonalCenterController就是你需要返回到指定的控制器名称,这里我需要跳转到HSYPersonalCenterController这个控制器
if ([vc isKindOfClass:[HSYPersonalCenterController class]]) {
[viewControllers addObject:vc];
break;
}
}
// 把控制器重新添加到导航控制器
[navigationVC setViewControllers:viewControllers animated:YES];
[navigationVC popViewControllerAnimated:YES];