拉勾技术人年薪【50W+】成长计划!

 

试图更改私有视图的布局边距时出现错误

 

解决方案:

if (@available(iOS 13.0, *)) {
    UIEdgeInsets margins = view.layoutMargins;
    CGRect frame = view.frame;
    frame.origin.x = -margins.left;
    frame.origin.y = -margins.top;
    frame.size.width += (margins.left + margins.right);
    frame.size.height += (margins.top + margins.bottom);
    view.frame = frame;
}

 

内容来源于网络如有侵权请私信删除