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];
[[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];
相关文章推荐
- MXE (M cross environment) Requirements
- Longest Increasing Subsequence
- 关于UIView布局的总结
- leetcode 232. Implement Queue using Stacks
- UIUITableView仿淘宝的两列式cell显示
- UE4之GamePlay
- iOS学习之—— UIDevice、NSBundle、NSLocale
- iOS 视图UIview属性介绍 以及视图层次方法
- iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet二合一)
- 使用UIBezierPath和CAShapeLayer画各种图形
- 10.UIImageView
- IOS开发 REST请求 ASIHTTPRequest用法
- iOS UITextFiled 后边的小叉号或是一次性删除输入的文字
- AndroidStudio导入新项目一直卡在Building gradle project info的解决解决方案
- PHP_SELF、 SCRIPT_NAME、 REQUEST_URI区别
- 一图了解View的生命周期,自定义view,invalidate()和requestLayout()调用
- Vue.js-----轻量高效的MVVM框架(二、Vue.js的简单入门)
- UEFI 安装win10 ubuntu双系统
- MultipartEntityBuilder.addTextBody 中文乱码
- ios学习--UIColor的你想知道的所有