我想在视图控制器中添加 2 个导航控制器。这 2 个 navigationController 是完全独立的,没有链接。我想将这 2 个 navigationViewController 并排显示,例如 splitviewcontroller。
使用 childViewController,我成功地将 2 个 viewController 添加到我想要的位置和大小。但是当我尝试使用 navigationController 时,它们会占据所有屏幕并显示在点 (0,0)。我尝试更改 navigationController 的框架,但没有任何改变。
任何人都可以帮助我吗?
非常感谢。
编辑:这是我用来添加 childVC 的代码:
self.meetingsListViewController = [[MeetingsListViewController alloc] initWithNibName:@"MeetingsListViewController" bundle:nil];
self.navCalendar = [[UINavigationController alloc] initWithRootViewController:meetingsListViewController];
[self.navCalendar setNavigationBarHidden:NO];
self.meetingsListViewController.view.frame = CGRectMake(10, 54, self.view.frame.size.width/2-20, self.view.frame.size.height - 64);
self.navCalendar.view.frame = self.meetingsListViewController.view.frame;
self.navCalendar.view.autoresizesSubviews = NO;
[self addChildViewController:meetingsListViewController];
[self.view addSubview:self.meetingsListViewController.view];
[self.navCalendar didMoveToParentViewController:self];
self.listPlaylistViewController = [[ListPlaylistViewController alloc] initWithNibName:@"ListPlaylistViewController" bundle:nil];
self.navPlaylist = [[UINavigationController alloc] initWithRootViewController:listPlaylistViewController];
[self.navPlaylist setNavigationBarHidden:NO];
self.listPlaylistViewController.view.frame = CGRectMake(self.view.frame.size.width/2+10, 54, self.view.frame.size.width/2-20, self.view.frame.size.height - 64);
self.navPlaylist.view.frame = self.listPlaylistViewController.view.frame;
self.navPlaylist.view.autoresizesSubviews = NO;
[self addChildViewController:listPlaylistViewController];
[self.view addSubview:self.listPlaylistViewController.view];
[self.navPlaylist didMoveToParentViewController:self];