Sorry for the newbie question. I have a UITabBar in my main window view as well as an array of UINavigationControllers for each Tab. The structure is similar to the iPod a
For this, You just need to take UITabBar controller -
.h File -
UITabBarController *_pTabBarController;
@property (nonatomic, retain) IBOutlet UITabBarController *_pTabBarController;
.m File -
// synthesize it
@synthesize _pTabBarController;
At initial load
// You can write one function to add tabBar -
// As you have already mentioned you have created an array , if not
_pTabBarController = [[UITabBarController alloc] init];
NSMutableArray *localViewControllersArray = [[NSMutableArray alloc] initWithCapacity:4];
UINavigationController *theNavigationController;
_pController = [[Controller alloc] initStart];
_pController.tabBarItem.tag = 1;
_pController.title = @"Baranches";
theNavigationController = [[UINavigationController alloc] initWithRootViewController:_pController];
theNavigationController.tabBarItem.tag = 1;
theNavigationController.tabBarItem.image = [UIImage imageNamed:@"icon_branches.png"];
[localViewControllersArray addObject:theNavigationController];
[theNavigationController release];
than you can set index as per your needs
self._pTabBarController.selectedIndex = 0; // as per your requirements