我讀過所有與此類似的SO問題,我很迷茫。我收到以下錯誤:這是在討論什麼佈局約束?
2015-09-14 22:59:40.455 guess-who[60143:9602686] 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:0x7c0f8e30 UIImageView:0x7b6efb60.top == _UILayoutGuide:0x7c0f67a0.top>",
"<_UILayoutSupportConstraint:0x7c0f8ae0 V:[_UILayoutGuide:0x7c0f67a0(0)]>",
"<_UILayoutSupportConstraint:0x7c0f0070 _UILayoutGuide:0x7c0f67a0.bottom == UIView:0x7c0f65e0.bottom>",
"<NSAutoresizingMaskLayoutConstraint:0x7b6f6130 h=--& v=--& UIImageView:0x7b6efb60.midY == + 204>",
"<NSAutoresizingMaskLayoutConstraint:0x7b6f6160 h=--& v=--& V:[UIImageView:0x7b6efb60(220)]>",
"<NSLayoutConstraint:0x7b6f6dc0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7c0f65e0(518)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7b6f6e20 h=-&- v=-&- 'UIView-Encapsulated-Layout-Top' V:|-(0)-[UIView:0x7c0f65e0] (Names: '|':UIView:0x7c0effc0)>"
)
Will attempt to recover by breaking constraint
<_UILayoutSupportConstraint:0x7c0f0070 _UILayoutGuide:0x7c0f67a0.bottom == UIView:0x7c0f65e0.bottom>
我已經得到了本作一堆,我已經成功地解決了其他方面的限制,但是這一個是絆倒了我。我不知道UILayoutSupportConstraint
是什麼;文件不是很全面。我已經瀏覽了視圖調試器,並且UIView:0x7c0f65e0
似乎是指我的主視圖(雖然由於某種原因,它是空白視圖的孩子?)。我無法找到任何與0x7c0f67a0有關的東西,儘管這似乎是指LayoutGuide,他們的底部必須是平等的。我不知道有什麼其他工具可以用來解決這個問題。
編輯:
使用View調試器,我已經將範圍縮小到這兩個約束條件,這兩者都不知道的來源之一:
我不能找到其中任何一個被設置。我知道每個人的第一個建議是將translatesAutoresizingMaskIntoConstraints設置爲false,但是這破壞了我的整個佈局,我不知道如何解決它。
我可以看到你的整個項目嗎?這是關於自動佈局。 –
我應該特別展示什麼? – thumbtackthief
您的故事板。推它在github回購,所以我可以向你發送拉請求。 –