我有一個Autolayout和Size Classes的故事板。相當複雜的佈局,不幸的是,我不能真正確定如何在新項目中重現問題。
但是所討論的視圖被固定在屏幕的左和右邊緣與具有750的優先級的約束(即|-([email protected])-[myView]-([email protected])-|
,另外它具有大於或小於1000的優先級(即|-(>=0)-[myView]-(>=0)-|
)約束等於。這是爲了限制iPad的寬度,所以在容器約束中存在寬度約束width <= 600 @1000
和中心水平,並且視圖的寬高比約束爲3:1。說,很複雜什麼是_UITemporaryLayoutWidth,它爲什麼打破我的約束?
Interface Builder不顯示任何約束的問題。Xcode佈局預覽呈現正確的所有設備。
當我運行應用程序iOS告訴我它有衝突的約束。
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:0x7fd72853ff80 DMXKit.DipSwitchAssembly:0x7fd72990d0e0.width == 3*DMXKit.DipSwitchAssembly:0x7fd72990d0e0.height>",
"<NSLayoutConstraint:0x7fd728574e50 '_UITemporaryLayoutWidth' H:[DMXKit.DipSwitchAssembly:0x7fd72990d0e0(400)]>",
"<NSLayoutConstraint:0x7fd72856e9c0 V:[DMXKit.DipSwitchAssembly:0x7fd72990d0e0(133)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7ffb19798000 DMXKit.DipSwitchAssembly:0x7ffb1979a000.width == 3*DMXKit.DipSwitchAssembly:0x7ffb1979a000.height>
這重複了幾次,具有完全相同的(即相同的指針)約束。這也很奇怪,看起來約束並沒有被打破。運行時,該應用程序看起來100%正確。當我在Xcode視圖調試器中查看應用程序時,地址爲0x7ffb19798000
的約束仍然存在,因此它從未被破壞。
_UITemporaryLayoutWidth
constaint來自哪裏?很明顯,我沒有添加它。谷歌不會吐出有關_UITemporaryLayoutWidth
的任何有用信息。有沒有人遇到過這樣的問題?
我有很多的這些警告也在日誌中。雖然,它似乎沒有打破我的佈局。我想知道這些'_UITemporaryLayoutWidth來自哪裏。 – dergab