自定义UITabbarItem的title字体颜色
2016-04-27 17:25
567 查看
/* You may specify the font, text color, and shadow properties for the title in the text attributes dictionary, using the keys found in NSAttributedString.h.
中文大意:您可以指定字体、文本颜色和阴影属性的标题文本属性字典,使用钥匙NSAttributedString.h中找到。
*/
- (void)setTitleTextAttributes:(nullable
NSDictionary<NSString *,id> *)attributes forState:(UIControlState)state
NS_AVAILABLE_IOS(5_0)
UI_APPEARANCE_SELECTOR;
将下面代码直接拷贝到工程即可设定标签字体颜色
中文大意:您可以指定字体、文本颜色和阴影属性的标题文本属性字典,使用钥匙NSAttributedString.h中找到。
*/
- (void)setTitleTextAttributes:(nullable
NSDictionary<NSString *,id> *)attributes forState:(UIControlState)state
NS_AVAILABLE_IOS(5_0)
UI_APPEARANCE_SELECTOR;
将下面代码直接拷贝到工程即可设定标签字体颜色
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor whiteColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal]; UIColor *titleHighlightedColor = [UIColor getColor:@"05a2ea"]; [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: titleHighlightedColor, NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
相关文章推荐
- Android Studio在build的时候出现transformClassesWithDexForDebug
- 303. Range Sum Query - Immutable
- Arduino ESP8266编程深入要点
- Arduino ESP8266编程深入要点
- android studio 启动项目时“Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled”
- Java 7 关于break和continue后的标签
- 5.0systemUI启动流程
- UItabBar上添加红点
- iOS开发--UIImage转化成NSData
- boundingRectWithSize 的使用, 计算UILable高度, 包含Emoji及多属性string.
- git Pull Request 是什么意思?
- Tiled GPU perf. warning: Backbuffer was not cleared/discarded, doing Render.OpaqueGeometry/RenderFor
- Java常见错误-“Dynamic Web Module 3.0 requires Java 1.6 or newer.”错误
- 【小米3使用经验】小米3联通版 miui7.2.11稳定版刷机
- UIView-iOS初学
- ueditor子表控件绑定事件的扩展优化
- Android酷炫实用的开源框架(UI框架)
- Build.gradle详细配置说明
- 在继承自 UITableViewController 重构时使用 xib 无法显示问题,
- autolayout中 top layout guide详解