我正在将一堆视图推送到我的导航控制器,但是在一些导航选项中我不想将它们添加到长列表中,但我希望它显示在堆栈的前面并摆脱其余部分。
这是我正在使用的行为:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NavigationTestAppDelegate *appDelegate = (NavigationTestAppDelegate *) [[UIApplication sharedApplication] delegate];
UIViewController *targetController = nil;
switch (indexPath.row) {
case 0:
targetController = [[ClientListViewController alloc] init];
targetController.title = @"Clients";
break;
case 1:
break;
case 2:
targetController = [[MyInfoViewController alloc] init];
targetController.title = @"My Information";
break;
default:
break;
}
if ([targetController isKindOfClass:[ClientListViewController class]])
{
[[self navigationController] pushViewController:targetController animated:YES];
} else {
if (targetController)
[[appDelegate.homeViewController navigationController] pushViewController:targetController animated:YES];
if (appDelegate.popoverController)
[appDelegate.popoverController dismissPopoverAnimated:YES];
}
[targetController release];
}
如果我的用户点击MyInfoViewController,我希望它是导航控制器堆栈中的唯一内容并让它滑入。