简体   繁体   English

UINavigationController标题和按钮未显示在UITabBarController中

[英]UINavigationController Title(s) and buttons are not displayed within UITabBarController

Im having difficulty getting the titles of the navigation bars to display along with the buttons within my tabBarController interface. 我在获取导航栏标题以及tabBarController界面中的按钮显示时遇到困难。 Im creating the tabBarController programmatically. 我以编程方式创建tabBarController。 Here is the screenshot for reference. 这是供参考的屏幕截图。 在此处输入图片说明

I have tried putting self.navigationController.navigationBarHidden = YES; 我试过把self.navigationController.navigationBarHidden = YES; within the alloc/init method of the tabBarController which is allocated in the appDelegate and set as the windows rootViewController. 在tabDBargate的alloc / init方法中,该方法在appDelegate中分配并设置为Windows rootViewController。 I've also tried to set its title with this code self.navigationController.title = [[self.viewControllers objectAtIndex:self.selectedIndex]title ]; 我还尝试使用此代码设置其标题self.navigationController.title = [[self.viewControllers objectAtIndex:self.selectedIndex]title ]; . I have also tried using the same code within the viewDidLoad method of my tabBarController class. 我也尝试过在tabBarController类的viewDidLoad方法中使用相同的代码。 Within the UITabBarController's alloc/init method I do have this code to set the nav controllers that I have added to the viewControllers array. 在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 ;

The title that appears in the navigation bar is the title of the currently showing view controller (the top of the navigation controller's stack). 导航栏中出现的标题是当前显示的视图控制器的标题(导航控制器堆栈的顶部)。 You should set the title of the individual view controllers embedded in the navigation controller, not the navigation controller itself. 您应该设置嵌入在导航控制器中的各个视图控制器的标题,而不是导航控制器本身。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UITabBarController中的UINavigationController,设置导航控制器标题 - UINavigationController within a UITabBarController, setting the navigation controller title UINavigationController标题不显示? - UINavigationController title is not displayed? UITabBarController内部的UINavigationController的UINavigationBar中的按钮缺少插入 - Missing inset for buttons in UINavigationBar of UINavigationController inside UITabBarController UINavigationController的导航栏似乎不可见,但标题和按钮仍然可见 - UINavigationController's nav bar seems invisible, but title and buttons are still visible UITabBarController和UINavigationController中特定UIViewController中的设备旋转 - Device rotation in a specific UIViewController within UITabBarController and UINavigationController 在UITabBarController和UINavigationController中以编程方式显示视图 - Present View within UITabBarController & UINavigationController Programmatically UINavigationController包含一个UITableView,然后是带有更多UITableView的UITabBarController - UINavigationController containing a UITableView, then a UITabBarController with more UITableView's 隐藏在UINavigationController后面的UITabbarController的“完成”按钮 - UITabbarController's “Done” button hidden behind UINavigationController 在UITabBarController中设置UINavigationController的UITabBarItem - Set UINavigationController's UITabBarItem inside a UITabBarController 具有UINavigationController的UITabBarController - UITabBarController with UINavigationController
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM