I have window-based application, I add MainMenuViewController .h and .m, and in AppDelegate.m I created tabBarController
MainMenuViewController *mmvc = [[MainMenuViewController alloc] init]; FavesViewController *fvc = [[FavesViewController alloc] init]; UITabBarController *tbc = [[UITabBarController alloc] init]; tbc.viewControllers = [NSArray arrayWithObjects:mmvc, fvc, nil]; [self.window addSubview:tbc.view];
In MainMenuViewController I have button which action is - go to other View
-(IBAction) goToTableView { MyViewController *mtvc = [[MyViewController alloc] init]; [self.view addSubview:mvc.view]; }
But when I press in Main Menu tabBar item it loads MyTableView, not MainMenuViewController. I want that when I press tabBar item MainMenu it will loading MainMenuViewController, not ViewController that was loading from MainMenuViewController. How to do that? Thank you.