0
我在我的应用程序5次,我的appDelegate通过下列方式设置它们:只有一个现有的5个视图中的SplitViewController?
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:navigationcontroller1, navigationcontroller7, navigationcontroller5, navigationcontroller4, navigationcontroller6, navigationcontroller2, nil];
self.window.rootViewController = tabBarController;
它们都配备了NavigationController和tabbarcontroller,但我需要把屏幕分割成两个部分,在这种情况下,屏幕将被划分将navigationcontroller2,你可以看到如下:
VendaViewController *venda_viewcontroller = [[VendaViewController alloc] init];
UINavigationController *navigationcontroller2 = [[UINavigationController alloc] init];
[navigationcontroller2 pushViewController:venda_viewcontroller animated:YES];
因此我尝试以下方法:
VendaViewController *venda_viewcontroller = [[VendaViewController alloc] init];
VendaDetailViewController *vendaDetail_viewcontroller = [[VendaDetailViewController alloc] init];
UISplitViewController *splitVC = [[UISplitViewController alloc] init];
[splitVC setViewControllers:[NSArray arrayWithObjects:venda_viewcontroller,vendaDetail_viewcontroller,nil]];
UINavigationController *navigationcontroller2 = [[UINavigationController alloc] init];
[navigationcontroller2 pushViewController:splitVC animated:YES];
但不是在此代码的工作,但在UISplitViewController的文档编写以下消息:
“你必须从UISplitViewController对象 为您的应用程序窗口的根视图安装视图。 [...]拆分视图 控制器不能模态呈现。”
所以......如果我喜欢把一个splitViewController在我的视图控制器,我得把splitViewController在所有我的看法控制器?或者有其他解决方案?
感谢这个链接帮助我很多! – user3526713