更新后查看tabbar 发现在iOS13下tabbar 文字发生偏移 并且颜色变为系统默认颜色
解决方法:
if(@available(iOS13.0, *)) {
UITabBarAppearance *appearance = UITabBarAppearance.new;
NSMutableParagraphStyle *par = [[NSMutableParagraphStyle alloc]init];
par.alignment = NSTextAlignmentCenter;
UITabBarItemStateAppearance *normal = appearance.stackedLayoutAppearance.normal;
if(normal) {
normal.titleTextAttributes = @{NSForegroundColorAttributeName:[<你要设置的默认颜色>],NSParagraphStyleAttributeName : par};
}
UITabBarItemStateAppearance *selected = appearance.stackedLayoutAppearance.selected;
if(selected) {
selected.titleTextAttributes = @{NSForegroundColorAttributeName:[<你要设置的选中颜色>],NSParagraphStyleAttributeName : par};
}
self.tabBar.standardAppearance= appearance;
}
