gpt4 book ai didi

ios - 改变标签栏文字颜色,iPhone

转载 作者:可可西里 更新时间:2023-11-01 05:00:44 25 4
gpt4 key购买 nike

我以编程方式创建了一个标签栏。

我们可以更改标签栏项目标题的颜色吗?默认为白色,我正在尝试将其设为黑色。

有点像

 tabbaritem.text.textcolor=[UIcolor Blackcolor];

谢谢

最佳答案

在 iOS5 中,您使用外观代理来更改标题颜色:

对于特定的标签栏项目:

[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"AmericanTypewriter" size:20.0f], UITextAttributeFont,
[UIColor yellowColor], UITextAttributeTextColor,
[UIColor redColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)], UITextAttributeTextShadowOffset,
nil] forState:UIControlStateNormal];

或将 self.tabBarItem 替换为 [UITabBarItem appearance] 以更改所有标签栏项目。如果您想全部更改,我建议您将代码放在 appdelegate didFinishLaunchingWithOptions:

关于ios - 改变标签栏文字颜色,iPhone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11343894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com