ios 设置tabbar文字颜色
2020-08-17 本文已影响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];
}