本文介绍了Xcode 4.4约束错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Xcode 4.4并在界面生成器中创建我的视图。当我运行我的应用程序,我一直得到以下约束错误。
I am using Xcode 4.4 and creating my views in interface builder. When I run my app, I consistently get the following constraint errors.
Unable to simultaneously satisfy constraints:
(
"<NSAutoresizingMaskLayoutConstraint:0x104486db0 h=-&- v=-&- V:[NSView:0x106a33090]-(0)-| (Names: '|':NSClipView:0x106a0cef0 )>",
"<NSAutoresizingMaskLayoutConstraint:0x104486e10 h=-&- v=-&- V:|-(15)-[NSView:0x106a33090] (Names: '|':NSClipView:0x106a0cef0 )>",
"<NSAutoresizingMaskLayoutConstraint:0x1002da350 h=--& v=--& V:[NSClipView:0x106a0cef0(672)]>",
"<NSLayoutConstraint:0x106a11ba0 V:[NSView:0x1044eb990]-(657)-| (Names: '|':NSView:0x106a33090 )>",
"<NSLayoutConstraint:0x1044d68d0 V:|-(270)-[NSView:0x1044eb990] (Names: '|':NSView:0x106a33090 )>",
"<NSLayoutConstraint:0x100271040 V:[NSView:0x1044eb990(245)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x100271040 V:[NSView:0x1044eb990(245)]>
Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints
to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens.
And/or, break on objc_exception_throw to catch this in the debugger.
有关如何解决这个问题的任何建议?
Any suggestions on how I can resolve this?
感谢
推荐答案
这样做:
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
这将摆脱日志中的NSAutoresizingMaskLayoutConstraint部分。
That will get rid of the "NSAutoresizingMaskLayoutConstraint" parts in the log.
这篇关于Xcode 4.4约束错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!