Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 带TabbarController的SplitViewController_Objective C_Cocoa Touch_Ipad - Fatal编程技术网

Objective c 带TabbarController的SplitViewController

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

我正在应用程序中使用拆分视图功能。我必须将tabbar放入rootViewController中

但当我在tabbar中添加控制器并将它们添加到split视图中时,它不会被拆分

它只显示detailViewController

以下是应用程序未完成启动时的代码:

- (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上也可用。虽然它是自定义控件,但它是拆分视图。检查此链接可能会对您有所帮助@你试过我的答案了吗?