我有一個帶2個選項卡的iPhone應用程序。這是我的申請代表:如何將navigationController添加到現有的選項卡應用程序?
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Add the tab bar controller's current view as a subview of the window
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
我的第一個標籤是UITableViewController
的子類。當有人點擊我的表的一行時,我想推一個新的視圖控制器。我知道,這是在didSelectRowAtIndexPath
做過這樣的:
TableViewDetailViewController *fvController = [[TableViewDetailViewController alloc] initWithNibName:@"TableViewDetailViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:fvController animated:YES];
[fvController release];
fvController = nil;
我self.navigationController
是NIL所以沒有東西推到視圖堆棧。我應該在哪裏創建我的導航控制器,以便儘可能少地更改代碼?