如何在 TVOS 焦点上更改标签栏项目文本颜色
标签栏中有四个项目.
1> 观看.(黑色)
2> 按需.(黑色)
3> 搜索.(黑色)
4> 设置.(我的颜色)
4> Settings. (My Colour)
如何更改标签栏中项目文本的颜色以匹配其图标颜色.(现在在标签栏中选择了性能)
How can i change the colour of item text in tab bar to match with its icon colour. (Right now Performance is selected in the tab bar)
在此处输入图片说明
如何更改标签栏中1,2,3"文本的颜色以匹配其图标颜色.(现在在标签栏中选择了性能)
How can I change the color of "1,2,3" text in tabbar to match with its icon color. (Right now Performance is selected in the tab bar)
我尝试设置 TitleTextAttributes.
I tried to set TitleTextAttributes.
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0),NSFontAttributeName: UIFont(name: "SFUIDisplay-Regular", size: 36.0)!], forState:UIControlState.Normal)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor(red: 22.0/255.0, green: 209.0/255.0, blue: 237.0/255.0, alpha: 1.0),NSFontAttributeName: UIFont(name: "SFUIDisplay-Regular", size: 36.0)!], forState:UIControlState.Focused)
但我想喜欢它.
这个问题出现在 tvos 9.1 中.
This issue got in the tvos 9.1.
我不确定我是否理解您的问题,但我在开发 Apple TV 应用程序时遇到了一些类似的问题.
I'm not sure if I understood your question but I faced some similar issue when developing an Apple TV app.
我想要做的是更改标签栏项目的字体颜色.
What I wanted to do is to change the font color for the tab bar items.
这就是我所做的.首先,我创建了一个 UITabBarController
子类,并将其添加到故事板上的控制器中.然后我在 -(void)viewDidLoad
This is what I ended doing. First I made a UITabBarController
subclass and liked it to their controller on the storyboard.
Then I added this code in the -(void)viewDidLoad
for(UITabBarItem * item in self.tabBar.items) {
[item setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor darkGrayColor]} forState:UIControlStateNormal];
[item setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blueColor]} forState:UIControlStateFocused];
}
而且一切正常.
希望有帮助!