在尝试了很多方法之后我需要问这个问题,有什么方法可以在splitView的rootViewcontroller(leftside)视图中创建tabbar。 如果有人有一些示例代码,请发帖给我。
这是我的代码,但它无法正常工作。它总是打开detailView,甚至没有拆分视图..
if([self isPad])
{
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];
NSArray *viewControllers = [NSArray arrayWithObjects:rootViewController, viewController2,viewController3,viewController4,nil];
//self.tabBarController.viewControllers = [NSArray arrayWithObjects: rootViewController,viewController2,viewController3,viewController4, nil];
[tabBarController setViewControllers:viewControllers];
// self.tabBarController.view=rootViewController.view;
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;
}
if([self isPad])
{
//[window addSubview:splitViewController.view];
self.window.rootViewController = self.splitViewController;
}
else
{
[window addSubview:tabBarController.view];
}