将选项卡栏视图添加到现有的基于表的应用程序中-iPhone
问题描述:
我有一个基于表的应用程序,想在底部添加一个标签栏,以便在此表和其他视图之间切换.
I have a table based app and would like to add a tab bar to the bottom to switch between this table and other views.
msot轻松实现此目的的方法是什么?我可以在表格视图下插入标签视图控制器吗?
What is the msot hassle free way to do this ? Can I just wire in a tab view controller underneath the table view?
谢谢
马丁
答
实际上,您必须将视图控制器加载到UITabBarController中.因此,如果您有tableViewController,viewController1和viewController 2,则要将所有这些添加到tabBarController.
You actually have to load your view controllers into a UITabBarController. So if you have a tableViewController, viewController1, and viewController 2, you want to add all those to the tabBarController.
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers:[NSArray arrayWithObjects:tableViewController, vc1, vc2];
[self.window addSubView:tabBarController.view];
[self.window makeKeyAndVisible];