我以编程方式创建了一个选项卡栏。
我们可以更改标签栏项目标题的颜色吗?
默认是白色,我想把它变成黑色。
就像是
tabbaritem.text.textcolor=[UIcolor Blackcolor];
Thanks
在 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
with [UITabBarItem appearance]
更改所有选项卡栏项目。
如果你想全部更改,我建议你将代码放在 appdelegate 上didFinishLaunchingWithOptions:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)