Within my iPhone application I have a common tab bar with three tabs that is presented from several views after pressing a button. The approach I followed was the workflow of Tweetie application, described in Robert Conn post.
Note that the main controller is a navigation controller; the tab bar is placed in a view controller's NIB file of the navigation stack, and the effect of switching between tabs is handled in a delegate didSelectItem method.
@interface GameTabBarController : UIViewController<UITabBarDelegate> {
UITabBar *tabBar;
UITabBarItem *lastGameTabBarItem;
UITabBarItem *previousGamesTabBarItem;
UITabBarItem *myBetsTabBarItem;
NSArray *viewControllers;
UIViewController *currentViewController;
}
@implementation GameTabBarController
...
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
UIViewController *viewController = nil;
// Get the view controller linked to the tab bar item pressed
...
// Switch to the view
[self.currentViewController.view removeFromSuperview];
[self.view addSubview:viewController.view];
self.currentViewController = viewController;
}
...
@end
Since the views of the tab bar must be customized according to the view controller the application came from, I have made this GameTabBarController a parent class with that NIB file that have the tab bar. Then, I have created several children classes:
@interface FirstGameTabBarController : GameTabBarController {
...
}
@interface SecondGameTabBarController : GameTabBarController {
...
}
...
My problem is that in some of the children classes I would like to remove the third tab of the NIB file associated with parent class. But since there is no UITabBarController involved, I cannot follow typica