【发布时间】:2012-03-13 08:27:12
【问题描述】:
我在我的应用程序中使用拆分视图功能。我必须将标签栏放在 rootViewController 中。
但是当我在标签栏中添加控制器并将它们添加到拆分视图时它不会拆分。
它只显示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;
}
【问题讨论】:
-
请指定标题,如“Splitview with tabbar for iPad”。
-
SplitView 是只有 iPad 才有的控件
-
不,请查看此链接:cocoacontrols.com/platforms/ios/controls/… 现在它也可以在 iPhone 上使用。虽然它是自定义控件,但它是拆分视图。
-
查看此链接可能对您有所帮助。 stackoverflow.com/questions/2475139/…
-
@ShwetaThakar:你试过我的答案了吗?
标签: objective-c cocoa-touch ipad