SplitViewController与TabbarController [英] SplitViewController with TabbarController

查看:266
本文介绍了SplitViewController与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



http://mikebluestein.wordpress.com/2010/04/03/using-a-uisplitviewcontroller-to-create-a-master-detail-ipad-app-with- monotouch /



添加分割视图后,您只需要将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

http://mikebluestein.wordpress.com/2010/04/03/using-a-uisplitviewcontroller-to-create-a-master-detail-ipad-app-with-monotouch/

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆