Autolayout约束警告“将试图通过打破约束来恢复”

时间:2015-02-17 22:25:09

标签: ios objective-c xcode uitableview autolayout

我正在尝试实施新闻提要(不知何故像没有评论或喜欢的Instagram)。它工作,但xcode继续显示此错误。我尝试改变所有约束,然而,我无法开始工作。 tableview的高度为475,图像的高度为400,白色区域的标签为75.

我确实使用了

self.tableView.estimatedRowHeight = 475;
self.tableView.rowHeight = UITableViewAutomaticDimension;

任何帮助?

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:0x174096530 UIImageView:0x1743e9000.top == UITableViewCellContentView:0x17418af80.topMargin + 13>",
    "<NSLayoutConstraint:0x1740977f0 V:[PFImageView:0x1743e8e00]-(0)-|   (Names: '|':UITableViewCellContentView:0x17418af80 )>",
    "<NSLayoutConstraint:0x174097840 V:[UIImageView:0x1743e9000]-(24)-[PFImageView:0x1743e8e00]>",
    "<NSLayoutConstraint:0x174097890 H:|-(0)-[PFImageView:0x1743e8e00]   (Names: '|':UITableViewCellContentView:0x17418af80 )>",
    "<NSLayoutConstraint:0x174097930 H:[PFImageView:0x1743e8e00]-(0)-|   (Names: '|':UITableViewCellContentView:0x17418af80 )>",
    "<NSLayoutConstraint:0x174097ac0 PFImageView:0x1743e8e00.width == PFImageView:0x1743e8e00.height>",
    "<NSLayoutConstraint:0x174097b60 V:[UIImageView:0x1743e9000(30)]>",
    "<NSLayoutConstraint:0x174092ed0 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x17418af80(375)]>",
    "<NSLayoutConstraint:0x174092f20 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x17418af80(44)]>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x174097b60 V:[UIImageView:0x1743e9000(30)]>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

1 个答案:

答案 0 :(得分:13)

我实际上解决了将图像约束底部的优先级更改为750的问题。感谢您的帮助。