Objective c 带TabbarController的SplitViewController
我正在应用程序中使用拆分视图功能。我必须将tabbar放入rootViewController中 但当我在tabbar中添加控制器并将它们添加到split视图中时,它不会被拆分 它只显示detailViewController 以下是应用程序未完成启动时的代码:Objective c 带TabbarController的SplitViewController,objective-c,cocoa-touch,ipad,Objective C,Cocoa Touch,Ipad,我正在应用程序中使用拆分视图功能。我必须将tabbar放入rootViewController中 但当我在tabbar中添加控制器并将它们添加到split视图中时,它不会被拆分 它只显示detailViewController 以下是应用程序未完成启动时的代码: - (void)applicationDidFinishLaunching:(UIApplication *)application { UIViewController *viewController2,*viewCont
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UIViewController *viewController2,*viewController3,*viewController4;
rootViewController = [[[CategoryItemsList alloc] init] autorelease];
viewController2 = [[[SearchList alloc] init] autorelease];
viewController3 = [[[FavoritesList alloc] init] autorelease];
viewController4 = [[[Information alloc] init] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects: rootViewController,viewController2,viewController3,viewController4, nil];
splitDetail = [[splitDetailView alloc] initWithNibName:@"splitDetailView" bundle:nil];
UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:tabBarController];
splitViewController = [[UISplitViewController alloc] init];
// splitViewController.tabBarItem = controller.tabBarItem;
splitViewController.viewControllers = [NSArray arrayWithObjects:nav, splitDetail, nil];
splitViewController.delegate=splitDetail;
rootViewController.splitView=splitDetail;
}
您可以参考此链接。我认为这就是你所期待的: 添加拆分视图后,只需将SplitViewController的对象作为其中一个ViewController添加到TabBarController
希望这能有所帮助。请指定类似“Splitview with tabbar for iPad”的标题。Splitview是仅在iPadNop中可用的控件,请查看此链接:现在它在iPhone上也可用。虽然它是自定义控件,但它是拆分视图。检查此链接可能会对您有所帮助@你试过我的答案了吗?