如何知道autolayout ios中约束错误的含义?

时间:2016-03-10 11:17:21

标签: ios objective-c iphone autolayout

我在app中添加了对我的视图的约束。我收到了以下错误信息。我无法理解约束实际出错的地方。所以我怎么能理解它们的确切含义。

    "<NSLayoutConstraint:0x7fd0135d4c30 UIImageView:0x7fd0135d7470.width == 0.634361*UIImageView:0x7fd0135d7470.height>",
    "<NSLayoutConstraint:0x7fd01347c6c0 H:[UIImageView:0x7fd01347d270(20)]>",
    "<NSLayoutConstraint:0x7fd01347df10 H:|-(79)-[UIImageView:0x7fd01347d270]   (Names: '|':UIView:0x7fd013479d10 )>",
    "<NSLayoutConstraint:0x7fd01347df60 H:[UIImageView:0x7fd01347d270]-(60)-|   (Names: '|':UIView:0x7fd013479d10 )>",
    "<NSLayoutConstraint:0x7fd01347eb50 UIView:0x7fd013474330.width == 1.33058*UIView:0x7fd013474330.height>",
    "<NSLayoutConstraint:0x7fd01347f410 UIView:0x7fd013479d10.leading == UIView:0x7fd013479810.leading>",
    "<NSLayoutConstraint:0x7fd01347f460 UIView:0x7fd013479d10.trailing == UIView:0x7fd013479810.trailing>",
    "<NSLayoutConstraint:0x7fd01347f500 UIView:0x7fd013479810.width == 1.31405*UIView:0x7fd013474330.height>",
    "<NSLayoutConstraint:0x7fd013481970 UIImageView:0x7fd0135d7470.width == 0.507042*UIView:0x7fd01347fcd0.height>",
    "<NSLayoutConstraint:0x7fd0134819c0 UIView:0x7fd013474330.width == 0.354626*UIImageView:0x7fd0135d7470.height>",
    "<NSLayoutConstraint:0x7fd0134884d0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fd01347fcd0(667)]>"

1 个答案:

答案 0 :(得分:0)

我通过为每个约束添加唯一ID来创建解决方案。我从属性检查器添加了id。在日志打印后,我添加了&amp;这导致了这个问题。

以下链接帮了我很多 Unable to simultaneously satisfy constraints, will attempt to recover by breaking constraint