iOS13适配总结

1.原来的设置tabBarTitle选中及未选中状态的颜色代码失效

使用新代码

if (@available(iOS 13.0, *)) {
         UITabBarAppearance *appearance = UITabBarAppearance.new;
        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
        UITabBarItemStateAppearance *normal = appearance.stackedLayoutAppearance.normal;
        UITabBarItemStateAppearance *selected = appearance.stackedLayoutAppearance.selected;
            if (normal) {
                normal.titleTextAttributes = @{NSForegroundColorAttributeName:k_TabbrTextColor,NSParagraphStyleAttributeName : paragraphStyle};
            }
            if (selected) {
            selected.titleTextAttributes = @{NSForegroundColorAttributeName:k_TabbrSelectedTextColor,NSParagraphStyleAttributeName : paragraphStyle};
            }
            self.tabBar.standardAppearance = appearance;
        }

2.原本设置cell的accessoryType
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
如果你不准备适配暗夜模式,只将cell的背景色统一设置,UITableViewCellAccessoryDisclosureIndicator同样会将箭头图片的颜色进行修改,导致和cell背景色颜色相近。
解决办法是使用accessoryView属性,
self.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_arrowright_gray"]];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。