如何隐藏应用启动时的标签栏?

时间:2010-04-04 08:05:51

标签: iphone objective-c cocoa-touch uikit tabbar

所以,我想我的应用程序以UIViewController开始(没有看到tabbar),然后输入带导航栏和tabbar的UITableView。问题是Tabbar在app启动时可见,任何人都可以提供帮助,非常感谢...

2 个答案:

答案 0 :(得分:0)

我认为您应该将-presentModalViewController:animated:发送到您的主UIViewController,并使用标签栏控制器作为参数,或者只是执行此操作:

[myWindow addSubview: myTabBarController.view];

答案 1 :(得分:0)

使您的应用程序成为基于导航的应用程序(而不是基于标签栏的应用程序),然后在UITableView上添加标签栏。

添加UITabBar here

有帮助

我这样做:在这种情况下绘制表视图和地图视图(来自Locati应用程序)

tabBarController = [[UITabBarController alloc] init];          // creates your tab bar so you can add everything else to it

searchTableViewController = [[SearchTableViewController alloc] init];               // creates your table view - this should be a UIViewController with a table view in it, or UITableViewController
UINavigationController *searchTableNavController = [[[UINavigationController alloc] initWithRootViewController:searchTableViewController] autorelease];
[searchTableViewController release];                                                              // creates your table view's navigation controller, then adds the view controller you made. Note I then let go of the view controller as the navigation controller now holds onto it 

searchMapViewController = [[SearchMapViewController alloc] init];   
UINavigationController *mapTableNavController = [[[UINavigationController alloc] initWithRootViewController:searchMapViewController] autorelease];
[searchMapViewController release];                                                    // does exactly the same as the first round, but for your second tab at the bottom of the bar.

tabBarController.viewControllers = [NSArray arrayWithObjects:searchTableNavController, mapTableNavController,  nil]; //add both of your navigation controllers to the tab bar. You can put as many controllers on as you like

很久以前我发现了这种模式。对不起,我不能指向原文。 你需要将tabbarcontoller添加到相关视图([... view addSubView:tabBarController];)可能首先设置框架。