【发布时间】:2015-05-08 19:04:29
【问题描述】:
当 iPhone 的方向改变时,我试图改变 UIViews 的位置。当 iPhone 处于纵向模式时,我希望 container view 位于 tableView 之上。在横向模式下,它们应该并排(Container view:左;tableView:右)。我想使用auto-layout 来做到这一点。
这是我如何设置的图片:(图片采用:w Any h Compact。)
在模拟器中,一切都按预期工作。但是当 iPhone 的方向改变时,我得到以下错误:
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:0x7f83f254b7d0 V:[UIView:0x7f83f2564230(272)]>",
"<NSLayoutConstraint:0x7f83f251d9f0 V:[_UILayoutGuide:0x7f83f250c270]-(0)-[UIView:0x7f83f2564230]>",
"<NSLayoutConstraint:0x7f83f244bd00 UITableView:0x7f83f28c8e00.bottom == _UILayoutGuide:0x7f83f252f700.top>",
"<NSLayoutConstraint:0x7f83f244bd50 V:[UIView:0x7f83f2564230]-(0)-[UITableView:0x7f83f28c8e00]>",
"<_UILayoutSupportConstraint:0x7f83f254b880 V:[_UILayoutGuide:0x7f83f250c270(64)]>",
"<_UILayoutSupportConstraint:0x7f83f24e4aa0 V:|-(0)-[_UILayoutGuide:0x7f83f250c270] (Names: '|':UIView:0x7f83f2567df0 )>",
"<_UILayoutSupportConstraint:0x7f83f251d8e0 V:[_UILayoutGuide:0x7f83f252f700(49)]>",
"<_UILayoutSupportConstraint:0x7f83f2564300 _UILayoutGuide:0x7f83f252f700.bottom == UIView:0x7f83f2567df0.bottom>",
"<NSLayoutConstraint:0x7f83f257dec0 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7f83f2567df0(375)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f83f254b7d0 V:[UIView:0x7f83f2564230(272)]>
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.
错误可能很简单,但我不明白。 (同样,模拟器中的一切看起来都很好。)
【问题讨论】:
标签: objective-c xcode nslayoutconstraint autolayout