您的位置:首页 > 产品设计 > UI/UE

iOS UITabBarController中设置字体颜色及大小

2016-05-18 17:04 651 查看
1.正常状态下(还可以设置选中状态下的颜色)

[[UITabBarItem
appearance]setTitleTextAttributes:@{NSFontAttributeName:[UIFont
systemFontOfSize:10],NSForegroundColorAttributeName:[UIColor
whiteColor]} forState:UIControlStateNormal];

[[UITabBarItem
appearance]setTitleTextAttributes:@{NSFontAttributeName:[UIFont
systemFontOfSize:10],NSForegroundColorAttributeName:[UIColor
blackColor]}
forState:UIControlStateSelected];

2.iOS9.0之前的,现在已经废用

[[UITabBarItem
appearance] setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys:

[UIColor
whiteColor], UITextAttributeTextColor,

nil] forState:UIControlStateNormal];

UIColor *titleHighlightedColor = [UIColor
blackColor];

[[UITabBarItem
appearance] setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys:

titleHighlightedColor,
UITextAttributeTextColor,

nil] forState:UIControlStateSelected];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: