[英]coming the issues of auto layouts in the console
我正在嘗試自動布局概念,在這里,我在控制台中遇到了更多問題,有人可以告訴我如何解決這個問題
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:0x7faeb358e200 H:|-(0)-[UIImageView:0x7faeb35834b0] (Names: '|':UIView:0x7faeb35832c0 )>",
"<NSLayoutConstraint:0x7faeb358e390 UILabel:0x7faeb358a1e0'Welcome to'.leading == UIView:0x7faeb35832c0.leadingMargin + 46>",
"<NSLayoutConstraint:0x7faeb358e4d0 UIImageView:0x7faeb3585ab0.leading == UILabel:0x7faeb358a1e0'Welcome to'.leading + 28>",
"<NSLayoutConstraint:0x7faeb358e520 UIImageView:0x7faeb3585ab0.leading == UIImageView:0x7faeb35834b0.leading + 90>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7faeb358e390 UILabel:0x7faeb358a1e0'Welcome to'.leading == UIView:0x7faeb35832c0.leadingMargin + 46>
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.
2014-12-23 16:30:57.326 Aaja[11268:148329] Unable to simultaneously satisfy constraints.
這個問題反復出現十次
由於這個錯誤,您有...
|[ImageView-b0]
|-46-[Label-e0]
-(+28)-[ImageView-b0]
[Label-e0]
i.e. |-74-[ImageView-b0] //this conflicts the first one.
[ImageView-b0]
-(+90)-[ImageView-b0]
這些是錯誤中顯示的不同約束。
看起來有點亂。 圖像視圖和超級視圖之間的間距為零。 然后,標簽和超級視圖之間將有46個間距。
但是,然后您嘗試將標簽和圖像視圖的左邊緣對齊,相差28。
然后,您還有另一個我不太了解的問題。 您正在告訴它使圖像視圖的前端與其自身對齊,但有所不同。 這將永遠無法工作。
它基本上是在告訴您,不能使所有約束都起作用,因為它們相互沖突,因此必須打破其中的一些約束。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.