我有3個標籤和主導航控制器。我實現的代碼:導航控制器內有3個標籤,沒有標題
UIViewController *monitorController = [[[MonitorController alloc] initWithNibName:@"MonitorController" bundle:nil] autorelease];
UIViewController *dashboardController = [[[DashboardController alloc] initWithNibName:@"DashboardController" bundle:nil] autorelease];
UIViewController *settingsController = [[[SettingsController alloc] initWithNibName:@"SettingsController" bundle:nil] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:monitorController, dashboardController, settingsController, nil];
self.navigationController = [[[UINavigationController alloc] initWithRootViewController:self.tabBarController] autorelease];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
我想改變導航冠軍時,我選擇另一個水龍頭,但無變量(見下文)不工作(沒有在導航控制器的任何標題):
self.title = DASHBOARD_TITLE;
self.navigationController.title = DASHBOARD_TITLE;
我該如何解決這個問題?
這不是解決問題的引用。 self.title = @「標題」將爲導航控制器和標籤控制器設置標題。 – OdNairy 2011-12-26 17:32:01
剛編輯我的答案! – Ecarrion 2011-12-26 17:37:07
首先,我需要在應用程序啓動時在導航控制器中顯示標題... – OdNairy 2011-12-26 17:42:10