iOS13适配问题

1、[self.textField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];奔溃
解决方案:

if (@available(iOS 13.0, *)) {
        self.textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor whiteColor]}];
    }
    else {
        [self.textField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
    }

2、在iOS13中presentViewController和之前弹出的样式不一样
会出现这种情况是主要是因为我们之前对UIViewController里面的一个属性,即modalPresentationStyle(该属性是控制器在模态视图时将要使用的样式)没有设置需要的类型。在iOS13中modalPresentationStyle的默认改为UIModalPresentationAutomatic,而在之前默认是UIModalPresentationFullScreen。
参考https://www.cnblogs.com/guoshaobin/p/11167191.html

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

推荐阅读更多精彩内容