我很难让导航栏的标题与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