1

所以,我希望我的应用程序以 UIViewController(没有看到标签栏)开始,然后输入带有导航栏和标签栏的 UITableView。问题是标签栏在应用程序启动时可见,任何人都可以帮助解决这个问题......

4

2 回答 2

0

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

这里有添加 UITabBar 的帮助

我这样做:在这种情况下,绘制一个表格视图和地图视图(来自 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];) 可能首先设置框架。

于 2010-04-04T09:21:08.300 回答
0

我认为您应该将标签栏控制器作为参数发送 -presentModalViewController:animated: 到您的主 UIViewController,或者只是这样做:

[myWindow addSubview: myTabBarController.view];
于 2010-04-04T08:18:11.780 回答