在一个运行良好的应用程序中,我只是在代码和故事板中进行了字符串转换,然后,我得到了“无法同时满足约束”错误。
错误是:
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:0x1d5408d0 V:[UIView:0x1d540c40(0)]>",
"<NSLayoutConstraint:0x1d540910 V:|-(0)-[UIView:0x1d540c40] (Names: '|':UIView:0x1d541100 )>",
"<NSLayoutConstraint:0x1d540fd0 V:[UILabel:0x1d541040(21)]>",
"<NSLayoutConstraint:0x1d5407d0 V:[UIView:0x1d540c40]-(20)-[UILabel:0x1d541040]>",
"<NSLayoutConstraint:0x1d540710 V:[LTSelectView:0x1d542210]-(360)-| (Names: '|':UIView:0x1d541100 )>",
"<NSAutoresizingMaskLayoutConstraint:0x1d5928b0 h=--& v=--& V:[UIView:0x1d541100(416)]>",
"<NSLayoutConstraint:0x1d540690 V:[UILabel:0x1d541040]-(19)-[LTSelectView:0x1d542210]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1d540fd0 V:[UILabel:0x1d541040(21)]>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
翻译负责吗?
我读了很多关于这个主题的帖子,但对我来说理由真的不容易理解。
所以我的目标是:
的UILabel: 身高等于21 宽度等于:220 顶部空间顶部布局:17 将中心X对齐:superview Selectview的底部空间:22
LTSelectView: 宽度等于:160 高度等于:30 将中心X对齐:superview UILabel的顶级空间:22 到UIButton的底部空间:67
的UIButton: 宽度等于:100 高度等于:30 SelectView的顶部空间:67 将中心对齐:superview
事实上我可以看到UILabel,UIButton而不是LTSelectView。所以问题肯定在这里。 我试图使用obj_exception_throw但我确实得到了任何东西。
经过其他测试,我只是iOS6上的问题。 iOS7上的情况很顺利。
答案 0 :(得分:0)
你的一个标签有太多的垂直约束而且它们不能同时满足。
更改某些约束的优先级或重建它们。