问题
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.
What is the msot hassle free way to do this ? Can I just wire in a tab view controller underneath the table view?
Thanks,
Martin
回答1:
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];
来源:https://stackoverflow.com/questions/5406213/adding-tab-bar-view-into-an-existing-table-based-app-iphone