Tabbar for views without tabbar items iPhone application
I am trying to use the tab bar controller in order to have a home view load with the tabbar items at the bottom but does not create a tab bar item for the home view. I managed to create views, display the tab bar on these views and create a respective tabbar item but I do not know how to NOT create the tabbar item.
thanks - hope thi开发者_C百科s makes sense
Do you want to hide the tabbar or distinct items you add to the tabbar controller?
Hiding the tabbar: tabBarController.tabBar.hidden = YES;
Else: If you don't want to see an item in the tabbar, don't add it. Manage further views within the controller you load into the tabbar controller by e.g. using an UINavigationController
You can create a tabbar automatically like this code sample:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
tabBarController = [[UITabBarController alloc] init];
MyViewController* vc1 = [[MyViewController alloc] init];
MyOtherViewController* vc2 = [[MyOtherViewController alloc] init];
NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil];
tabBarController.viewControllers = controllers;
// Add the tab bar controller's current view as a subview of the window
[window addSubview:tabBarController.view];
}
More about UITabBarControllers
精彩评论