2015-02-17 52 views
5

我试图实现新闻的饲料(不知何故像instagram没有评论或喜欢)。它的工作原理,但Xcode不断显示此错误。我试图改变所有的限制,但是,我不能去工作。桌面视图的高度为475,图像的高度为400,为带有标签的白色区域留下75。Autolayout约束警告“将尝试通过打破约束来恢复”

我没有使用

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. 
+0

看来,UIImageView的高度是过度约束。调查改变身高的限制,你应该找到问题所在。 – 2015-02-17 23:07:10

+0

@boyfarrell指出,我对你的约束做了一个简要的描述,而且他们可能不是你期望的。在Y轴上只有454个475的数据,如果PFImageVIew假设为相同的宽度/高度,则x轴将是400pts宽。尽管在这一点上,它会超出一些屏幕的界限。以及关于自动布局的简要说明:尽管出现这些消息,东西似乎仍然有效,但实际上它可能会导致非常意外的结果。操作系统正在做出最好的猜测,但这并不总是正确的猜测 – 2015-02-17 23:16:53

回答

12

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

+0

此提示还修复了地图视图旋转中的错误'Edge Insets'bottom == MKMapView – malhal 2017-01-31 00:39:48

+0

您为我的节日保存了我的一天!很高兴在日志中没有任何警告:) – 2017-10-26 08:44:46