// 设置标题颜色
let normal_attr = [NSAttributedString.Key.foregroundColor: UIColorFormRGB(rgbValue: 0x202020)]
let select_attr = [NSAttributedString.Key.foregroundColor: normalRedColor]
if #available(iOS 13.0, *) {
let appearance = UITabBarAppearance()
appearance.stackedLayoutAppearance.normal.titleTextAttributes = normal_attr
appearance.stackedLayoutAppearance.selected.titleTextAttributes = select_attr
tabBar.standardAppearance = appearance
} else {
UITabBarItem.appearance().setTitleTextAttributes(normal_attr, for: .normal)
UITabBarItem.appearance().setTitleTextAttributes(select_attr, for: .selected)
}
iOS tabbar颜色适配
最新推荐文章于 2024-10-30 15:43:07 发布