我正在尝试做一个纯粹的基于自动布局约束的应用程序,没有自动调整大小,在我的故事板中,我在故事板的Xcode 5文件属性中打开了“使用自动布局”标志,但我仍然收到异常。我没有在代码中的任何地方启用translatesAutoresizingMaskIntoConstraints。据我所知,如果自动布局打开,IB将禁用translatesAutoresizingMaskIntoConstraints。有什么想法吗?
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:0xdca62c0 V:[_UILayoutGuide:0xdca7310]-(201)-[UIView:0xcc69170]>",
"<NSLayoutConstraint:0xdca63e0 V:[UIView:0xcc69170]-(112)-[_UILayoutGuide:0xdc51f50]>",
"<_UILayoutSupportConstraint:0xdc581e0 V:[_UILayoutGuide:0xdca7310(52)]>",
"<_UILayoutSupportConstraint:0xdc97780 V:|-(0)-[_UILayoutGuide:0xdca7310] (Names: '|':UIView:0xdca7240 )>",
"<_UILayoutSupportConstraint:0xdc7e3b0 V:[_UILayoutGuide:0xdc51f50(32)]>",
"<_UILayoutSupportConstraint:0xdc7df20 _UILayoutGuide:0xdc51f50.bottom == UIView:0xdca7240.bottom>",
"<NSAutoresizingMaskLayoutConstraint:0xdcce0c0 h=--& v=--& V:[UIView:0xdca7240(320)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0xdca62c0 V:[_UILayoutGuide:0xdca7310]-(201)-[UIView:0xcc69170]>
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.发布于 2014-03-30 01:44:40
似乎某个视图的根视图控制器一直打开着translatesAutoresizingMaskIntoConstraints。您可以在情节提要文件的xml中看到这一点。但是,所有子视图都关闭了translatesAutoresizingMaskIntoConstraints。我怀疑这是正常的行为,但如果您希望不会发生任何转换,则会有点困惑。
https://stackoverflow.com/questions/22702605
复制相似问题