SplitViewController与TabbarController [英] SplitViewController with TabbarController
问题描述
但是当我在tabbar中添加控制器并将它们添加到分割视图中时它不会拆分。
它只显示detailViewController。
下面是应用程序中完成启动的代码: / p>
- (void)applicationDidFinishLaunching:(UIApplication *)application {
UIViewController * viewController2,* viewController3, * viewController4;
rootViewController = [[[CategoryItemsList alloc] init] autorelease];
viewController2 = [[[SearchList alloc] init] autorelease];
viewController3 = [[[FavoritesList alloc] init] autorelease];
viewController4 = [[信息分配] init] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:rootViewController,viewController2,viewController3,viewController4,nil];
splitDetail = [[splitDetailView alloc] initWithNibName:@splitDetailViewbundle: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;
}
。我认为这是您正在寻找的:
https ://github.com/mattgemmell/MGSplitViewController
http://www.raywenderlich.com/1040/ipad-for-iphone-developers-101-uisplitview-tutorial
添加分割视图后,您只需要将SplitViewController的对象作为viewControllers之一添加到TabBarController
希望这有助于。
I am using the split View functionality in my app.I have to put tabbar in rootViewController.
But when I add controllers in tabbar and add them into split view it doesnt split.
It only shows detailViewController.
Here is the code in application did finish launching:
- (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;
}
You can refer to this links. I think this is what you are looking out for:
https://github.com/mattgemmell/MGSplitViewController
http://www.raywenderlich.com/1040/ipad-for-iphone-developers-101-uisplitview-tutorial
Once you add the split view then you just need to add the object of the SplitViewController to the TabBarController as one of the viewControllers
Hope this helps.
这篇关于SplitViewController与TabbarController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!