iOS13下的tabbar小适配
2020-01-06 本文已影响0人
数字d
手机手机更新了系统,在iOS13以下的tabbar正常显示默认文字和颜色。
但是在iOS13系统下就如图所示的UI.
1 2找了资料也没找到合适的,最后问了一位大神,一行代码搞定。
if (@available(iOS 13, *)){
[[UITabBar appearance] setUnselectedItemTintColor:COLOR(179, 179, 179, 1)];
[[UITabBar appearance] setTintColor:COLOR(0, 224, 169, 1)];
}else
{
NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
NSMutableDictionary *selectTextAttrs = [NSMutableDictionary dictionary];
selectTextAttrs[NSForegroundColorAttributeName] = COLOR(0, 224, 169, 1);
textAttrs[NSForegroundColorAttributeName] = COLOR(179, 179, 179, 1);
[childVc.tabBarItem setTitleTextAttributes:textAttrs forState:UIControlStateNormal];
[childVc.tabBarItem setTitleTextAttributes:selectTextAttrs forState:UIControlStateSelected];
}