Masonry 约束冲突

问题简述:检查约束没问题,但是出现约束冲突

[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<MASLayoutConstraint:0x6080000becc0 UIView:0x7ff59160f680.left == JKRefreshAutoFooter:0x7ff591708790.left + 50>",
"<MASLayoutConstraint:0x6080000bed20 UIView:0x7ff59160f680.right == JKRefreshAutoFooter:0x7ff591708790.centerX - 53.34>",
"<NSAutoresizingMaskLayoutConstraint:0x608000282490 JKRefreshAutoFooter:0x7ff591708790.width == 0>"
)

Will attempt to recover by breaking constraint
<MASLayoutConstraint:0x6080000bed20 UIView:0x7ff59160f680.right == JKRefreshAutoFooter:0x7ff591708790.centerX - 53.34>

重点: "<NSAutoresizingMaskLayoutConstraint:0x608000282490 JKRefreshAutoFooter:0x7ff591708790.width == 0>"

父视图 width == 0 ?

解决:view 初始化之前 [self.view layoutIfNeeded];

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

推荐阅读更多精彩内容