我很難讓導航欄的標題與tabBarController界面中的按鈕一起顯示。我編程創建tabBarController。這裏是截圖供參考。 UINavigationController標題和按鈕不顯示在UITabBarController內
我試圖把self.navigationController.navigationBarHidden = YES;
其在分配的appDelegate和設定爲窗口RootViewController的所述tabBarController的分配/ init方法內。我也試着用這個代碼self.navigationController.title = [[self.viewControllers objectAtIndex:self.selectedIndex]title ];
來設置它的標題。我也嘗試在我的tabBarController類的viewDidLoad方法中使用相同的代碼。在UITabBarController的alloc/init方法中,我確實有這個代碼來設置我已經添加到viewControllers數組中的導航控制器。
UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:contactsTblView];
nav2.title = @"Contacts";
nav2.navigationItem.title = @"Contacts";
nav2.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemContacts tag:2];
nav2.delegate = self ;
@initWithQuestion,是的,是嗎?您正試圖設置導航控制器的標題。你應該(正如我在我的回答中所說)設置contactsTblView的標題。 – rdelmar 2014-10-08 23:48:34
我想出了你的答案,它確實奏效。 – initWithQuestion 2014-10-08 23:55:30