我的 iphone 应用程序中有一个标签栏控制器。一切都很好,直到第二个标签栏项目被点击。单击时,第二个选项卡的选项卡图标下的选项卡项目标题/名称将消失。但是第一个选项卡没有问题。
有谁知道这是什么原因。
我的 iphone 应用程序中有一个标签栏控制器。一切都很好,直到第二个标签栏项目被点击。单击时,第二个选项卡的选项卡图标下的选项卡项目标题/名称将消失。但是第一个选项卡没有问题。
有谁知道这是什么原因。
It may be the problem with the view controller in the second tab bar item. Have you used the title inside of the view controller of the second tab bar item. If no then try using title of the view controller to the name/title of the second tab bar item. I hope this should solve the issue.
就我而言,标题设置正确,但选择时标题的颜色为“清晰颜色”。
解决方案:
在 AppDelegate.m
[[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor blackColor] }
forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor redColor] }
forState:UIControlStateSelected];
从 viewController 中删除标题对我有用。我的设置是创建一个 UITabBarController,它通过从主故事板执行故事板引用来实际显示在其他故事板中,所以我只是从 UITabBarController 拖到故事板引用 - > 双击故事板引用以打开另一个故事板 - > 添加 tabBarItem到viewController->在代码中从该viewController中删除了标题=>效果很好