NSArray*temArray = self.navigationController.viewControllers;
TestListViewController *test = [[TestListView Controlleralloc] init];
for(UIViewController *temVCintemArray)
{
if([temVC isKindOfClass:[test class]])
{
[self.navigationController popToViewController:temVC animated:YES];
}
}
跨页面跳转至相关页面方法:
指定跳转页面设置对应 tag 值:
self.view.tag = 20000;//tag(需要跳转的当前 VC)
跳转事件 VC 所需实现的方法:
for (int i = 0; i < [self.navigationController viewControllers].count; i++) {
if ([[self.navigationController viewControllers] objectAtIndex:i].view.tag == 20000) {
navTag = i;
} else if ([[self.navigationController viewControllers] objectAtIndex:i].view.tag == 30000) {
navTag = i;
} else if ([[self.navigationController viewControllers] objectAtIndex:i].view.tag == 10000) {
navTag = i;
}
}
[self.navigationController popToViewController:[[self.navigationController viewControllers] objectAtIndex:navTag] animated:YES];