UITabBar 设置选中、未选中状态下title的字体颜色
2017-02-07 09:46
1056 查看
一、如果只是设置选中状态的字体颜色,使用 tintColor 就可以达到效果
二、但如果要将未选中状态和选中状态下的颜色都改变,可以使用 setTitleTextAttributes:<#(nullable NSDictionary<NSString *,id> *)#> forState:<#(UIControlState)#> 达到效果
或者
self.tabBar.tintColor = [UIColor redColor];
二、但如果要将未选中状态和选中状态下的颜色都改变,可以使用 setTitleTextAttributes:<#(nullable NSDictionary<NSString *,id> *)#> forState:<#(UIControlState)#> 达到效果
[nav.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]} forState:UIControlStateNormal]; [nav.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blueColor]} forState:UIControlStateSelected];
或者
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]} forState:UIControlStateNormal]; [[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blueColor]} forState:UIControlStateSelected];
相关文章推荐
- UITabBar 设置字体的颜色(选中状态/正常状态)setTitleTextAttributes
- ios 修改UITabBarItem字体颜色,正常与选中状态
- swift-UITabBarController 设置选中和未选中状态文字图片颜色或使用原图
- iOS开发 在storyboard中拖的UITabBarController,设置选中时的图片和字体颜色
- swift中设置状态栏标题的字体和颜色
- 自定义UITabbarItem的title字体颜色
- 设置tabbaritem的title颜色(选中和未选中)
- sublime text3如何设置鼠标选中后字体的颜色
- UITabBarController设置选中时图片和文字的颜色
- iOS开发-设置导航栏title字体颜色
- 设置Button的字体颜色状态选择器
- android spinner 选中后显示字体的颜色设置
- iOS如何把所有页面状态栏的字体颜色都设置为白色
- css样式设置鼠标选中后字体颜色以及背景颜色
- QTextEdit中选中文本修改字体与颜色,全部文本修改字体与颜色(设置调色板的前景色、背景色、文字颜色以及基色)
- 设置选中颜色和字体选中颜色的变化选择器
- iOS 设置NavigationItem的Title的字体大小和颜色
- 设置uitabbar里的字体颜色
- 设置ActioinBar 的背景色以及Title的字体颜色
- 用NSMutableAttributedString快速设置UIbutton Title/lable的文字:字体,大小,颜色