UITabBarItem *item = [UITabBarItem appearance];
[item setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#333333"],NSFontAttributeName:[UIFont systemFontOfSize:14]} forState:UIControlStateNormal];
[item setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#FF0009"],NSFontAttributeName:[UIFont systemFontOfSize:14]} forState:UIControlStateSelected];
if (@available(iOS 13.0, *)) {
// iOS13 及以上
self.tabBar.tintColor = [UIColor colorWithHexString:@"#FF0009"]; self.tabBar.unselectedItemTintColor = [UIColor colorWithHexString:@"#333333"];
}
网友评论