views:

59

answers:

2

Hi, 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 this makes sense

A: 

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

mgratzer
but if I dont add a view controller to the tab view controller, I don't see the tab bar
Lily
not adding a controller to a tab view controller is not making any sense, in this case you don't need one. and of course, if you don't add a controller it is empty and you don't see any tabs.
mgratzer
A: 

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

vodkhang