欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Client error attempting to change layout margins of a private view

程序员文章站 2023-11-09 21:12:28
试图更改私有视图的布局边距时出现错误 解决方案: ......

 

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

 

解决方案:

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;
}