我的应用程序只有一个视图控制器,需要横向显示,而其他视图控制器将是纵向的。当我尝试使用代码构建它时,我会收到这样的日志:
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.
(
<_UILayoutSupportConstraint:0x7fece31416f0 V:[_UILayoutGuide:0x7fece0dc94b0(64)]>,
<_UILayoutSupportConstraint:0x7fece0ddf0c0 V:|-(0)-[_UILayoutGuide:0x7fece0dc94b0] (Names: '|':UIView:0x7fece0dca270 )>,
<_UILayoutSupportConstraint:0x7fece3145cb0 V:[_UILayoutGuide:0x7fece3108140(0)]>,
<_UILayoutSupportConstraint:0x7fece31201c0 _UILayoutGuide:0x7fece3108140.bottom == UIView:0x7fece0dca270.bottom>,
<NSLayoutConstraint:0x7fece0de5700 V:[UIView:0x7fece3124110(280)]>,
<NSLayoutConstraint:0x7fece0dcf870 V:[UIButton:0x7fece3137790'开始训练'(42)]>,
<NSLayoutConstraint:0x7fece0dc4df0 V:[_UILayoutGuide:0x7fece0dc94b0]-(0)-[UIView:0x7fece3124110]>,
<NSLayoutConstraint:0x7fece0d42c60 V:[UIView:0x7fece3124110]-(0)-[UITableView:0x7fece112a000]>,
<NSLayoutConstraint:0x7fece0dec530 V:[UITableView:0x7fece112a000]-(0)-[UIButton:0x7fece3137790'开始训练']>,
<NSLayoutConstraint:0x7fece0df24c0 V:[UIButton:0x7fece3137790'开始训练']-(0)-[_UILayoutGuide:0x7fece3108140]>,
<NSLayoutConstraint:0x7fece3252110 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fece0dca270(320)]>,
)
Will attempt to recover by breaking constraint <NSLayoutConstraint:0x7fece0de5700 V:[UIView:0x7fece3124110(280)]>
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.
我的约束很简单,没有更改为横向就不会出现错误。有人遇到过这样的问题吗?