设置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];
}
网友评论