我使用2个UITableViews和一个UIViewController实现了一个splitview。用他们自己的数据在屏幕上显示这两个工作正常。 现在在我的DidSelectRowForIndexPath中,我做了以下事情:
DetailViewController *nextController = [[DetailViewController alloc] initWithStyle:UITableViewStylePlain];
NSMutableArray *objects;
objects = [[NSMutableArray alloc] initWithObjects:@"A", @"B", nil];
nextController.title = @"Filter";
[nextController SetArray:objects];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:nextController];
[self presentModalViewController:nc animated:YES];
//used this before [self.navigationController pushViewController:nextController animated:YES];
[FilterView deselectRowAtIndexPath:indexPath animated:YES];
答案 0 :(得分:2)
如果您在创建项目时从主/明细模板启动了应用程序。然后它会在appDelegate didFinishLaunching
方法中自动设置导航控制器,所以在didSelect
方法中你必须使用
`[self.navigationController pushViewController:vc animated:YES];`
而不是
[self presentModalViewController:nc animated:YES];
Here是一个示例代码,它使用拆分视图以及从根视图导航。
答案 1 :(得分:0)
首先你需要确认你在底部有UINavigationController然后你可以pushViewController:nextController
[FilterView deselectRowAtIndexPath:indexPath animated:YES];
DetailViewController *nextController = [[DetailViewController alloc] initWithStyle:UITableViewStylePlain];
NSMutableArray *objects;
objects = [[NSMutableArray alloc] initWithObjects:@"A", @"B", nil];
nextController.title = @"Filter";
[nextController SetArray:objects];
[self.navigationController pushViewController:nextController animated:YES];