iOS13适配总结

2019-11-04  本文已影响0人  FieryDragon
1.UINavigationBar 设置按钮边距导致崩溃
- (void)layoutSubviews {
    [super layoutSubviews];
    
    for (UIView *subview in self.subviews) {
        if ([NSStringFromClass([subview class]) containsString:@"_UINavigationBarContentView"]) {
            if ([UIDevice currentDevice].systemVersion.floatValue >= 13.0) {
                UIEdgeInsets margins = subview.layoutMargins;
                subview.frame = CGRectMake(-margins.left, -margins.top, margins.left + margins.right + subview.frame.size.width, margins.top + margins.bottom + subview.frame.size.height);
            } else {
                subview.layoutMargins = UIEdgeInsetsZero;
            }
            break;
        }
     }
}
2.取消深色模式
在info.plist中添加(key:User Interface Style   
            value:Light)关闭深色模式
3.模态弹出样式
设置弹出控制器modalPresentationStyle为 UIModalPresentationFullScreen类型。
4.私有方法 KVC 不允许访问
例:UITextField
原
[moneyTextField setValue:kRGB(0x2F3242) forKeyPath:@"_placeholderLabel.textColor"];
改为:
moneyTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"" attributes:@{NSForegroundColorAttributeName: kRGB(0x2F3242)}];
5.UITextField类leftview、rightView展示异常
问题:将UILabel、UIImageView类对象赋值给leftview时,展示大小为UILabel、UIImageView内容宽高,而不是设置的frame大小
解决:将UILabel、UIImageView类对象包一层UIView再赋值给leftView。
6.UIWebView 将被禁止提交审核
上一篇 下一篇

猜你喜欢

热点阅读