ナビゲーション コントローラーを使用する場合は、次のようにします。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//for home tab.. u want to add navigation controller
YourTableViewController *objviewController = [[[YourTableViewController alloc] initWithNibName:@"YourTableViewController_iPhone" bundle:nil] autorelease];
UINavigationController *navCtrl = [[UINavigationController alloc] initRootViewController:objviewController];
//for tab2...
YourSecondViewController *objYourSecondViewController = [[[YourTableViewController alloc] initWithNibName:@"YourSecondViewController_iPhone" bundle:nil] autorelease];
//for tab3...
YourThirdViewController *objYourThirdViewController = [[[YourThirdViewController alloc] initWithNibName:@"YourThirdViewController_iPhone" bundle:nil] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navCtrl,objYourSecondViewController,objYourThirdViewController,nil];
self.window.rootViewController=self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
ただし、ナビゲーションコントローラーが必要ない場合は、次のように追加することもできます。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DetailViewController *nextController = [self.storyboard instantiateViewControllerWithIdentifier:@"detailView"];
[self.view addSubView:nextController];
}