美文网首页
ios 设置tabbar文字颜色

ios 设置tabbar文字颜色

作者: 天山海梦 | 来源:发表于2020-08-17 16:47 被阅读0次

设置tabbar文字颜色:

if (@available(iOS 13.0, *))
{
UITabBar *tabBar = [UITabBar appearance];
[tabBar setTintColor:[UIColor lightGrayColor]];
[tabBar setUnselectedItemTintColor:[UIColor redColor]];
}
else
{
UITabBarItem *tabBarItem = [UITabBarItem appearance];
[tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor lightGrayColor]} forState:UIControlStateNormal];
[tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor redColor]}forState:UIControlStateSelected];

}

相关文章

网友评论

      本文标题:ios 设置tabbar文字颜色

      本文链接:https://www.haomeiwen.com/subject/bgmqjktx.html