iOS 约束冲突

来源:互联网 发布:网络福建师范大学校长 编辑:程序博客网 时间:2024/05/17 23:56

在使用AutoLayout的时候调试台打印出以下信息

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) (    "<NSLayoutConstraint:0x14e6dff0 DrawIconView:0x14d6d9b0.leading == UIView:0x14d6d600.leadingMargin>",    "<NSLayoutConstraint:0x14e55270 H:[DrawIconView:0x14d6d9b0(30)]>",    "<NSLayoutConstraint:0x14e5c740 UIView:0x14d6d600.trailingMargin == DrawIconView:0x14d6d9b0.trailing>",    "<NSLayoutConstraint:0x14e67d50 H:[UIView:0x14d6d600(50)]>")Will attempt to recover by breaking constraint

遇到这个问题不要木,仔细看一下应该是约束有冲突,向控制台里寻找更详细的信息,发现到了#986类似的字眼,错误大概就是出现在这个。
原来设置了WIDTH约束后又定义了CenterX 果断改为LeftMargin与RightMargin 再次运行 问题解决。

0 0