2015-02-17 58 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