美文网首页
iOS 13 适配记录

iOS 13 适配记录

作者: bugbiu | 来源:发表于2019-10-17 13:01 被阅读0次

暗黑模式 适配参考suiling的文章

模态弹窗的状态栏透明,是由于modalPresentationStyle默认是auto,设置modalPresentationStyle为需要的值可以解决,

tabbarnavigationbar的线隐藏失效,

CYLTabBarControllertabbar文字的颜色和字体失效,适配:

if (@available(iOS 13.0, *)) {
        UITabBar *tabbar = [UITabBar appearance];
        [tabbar setTintColor:[UIColor redColor]];
        
        // 普通状态下的文字属性
        NSMutableDictionary *normalAttrs = [NSMutableDictionary dictionary];
        normalAttrs[NSFontAttributeName] = kFont(12, UIFontWeightRegular);
        
        // set the text color for selected state
        // 选中状态下的文字属性
        NSMutableDictionary *selectedAttrs = [NSMutableDictionary dictionary];
        selectedAttrs[NSFontAttributeName] = kFont(12, UIFontWeightRegular);
        UITabBarItem *tabBarItem = [UITabBarItem appearance];
        [tabBarItem setTitleTextAttributes:normalAttrs forState:UIControlStateNormal];
        [tabBarItem setTitleTextAttributes:selectedAttrs forState:UIControlStateSelected];
    } else {
        // 普通状态下的文字属性
        NSMutableDictionary *normalAttrs = [NSMutableDictionary dictionary];
        normalAttrs[NSFontAttributeName] = kFont(12, UIFontWeightRegular);
        
        // set the text color for selected state
        // 选中状态下的文字属性
        NSMutableDictionary *selectedAttrs = [NSMutableDictionary dictionary];
        selectedAttrs[NSForegroundColorAttributeName] = [UIColor redColor];
        selectedAttrs[NSFontAttributeName] = kFont(12, UIFontWeightRegular);
        
        // set the text Attributes
        // 设置文字属性
        UITabBarItem *tabBarItem = [UITabBarItem appearance];
        [tabBarItem setTitleTextAttributes:normalAttrs forState:UIControlStateNormal];
        [tabBarItem setTitleTextAttributes:selectedAttrs forState:UIControlStateSelected];
    }

UITextFieldleftView直接设置UIButton、UIImageView等直接渲染图片的控件时,控件大小会自动设置为图片大小,需要在外层添加一层UIView防止自适应

相关文章

网友评论

      本文标题:iOS 13 适配记录

      本文链接:https://www.haomeiwen.com/subject/svvpuctx.html