In my UITabbar Application (created using xCode) I have 6 tab buttons. In the first tab I have 5 UIButttons which should load other 5 corresponding tabs when clicked on the buttons. First one is the index/home page others are the different modules with a nib file for each of the modules.
My question is when clicked on the Button1 it should load tabbar 1(index's start from 0 for Tabbar App) and when clicked on the Button2 it should load tabbar 2 and so on.
In the IB action I have written the following code
-(IBAction)Button1:(id)sender
{
firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstView"bundle:nil];
[self.view addSubview:firstViewController.view];
}
To the best of my knowledge this paints(adds) the firstViewController on the tabbar 0 instead of calling the tabbar index 1.
Should I try
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController;
If so where should I write this?