2

Whenever you do not provide autolayout constraints in Interface Builder, constraints are automatically created for you when you run the application.

I want to use Masonry to manage my own constraints, but the ones in storyboard are getting in the way.

The solution to this in Xcode 5 used to be that you can explicitly say that the auto-layout constraints are set to Placeholder / removed at build time, an option you can set in the Inspector:

screenie

But now in Xcode 6 beta 5 the screen looks like this:

screenie2

... and it's not clear to me what None does.

The worst thing is, it doesn't seem to remove any of the constraints, as you can see from the error!

What can I do in this case?

4

2 回答 2

1

我也有同样的问题。占位符约束根本不起作用。我现在要删除 NSIBPrototypingLayoutConstraint,然后再添加我自己的任何一个。

if ([self.view.constraints count] > 0) {
    [self.view removeConstraints:self.view.constraints];
}
于 2014-09-29T05:37:07.463 回答
1

以下是我在 XCode 6 的 Storyboard Editor 中修复此问题的方法:首先在要保持不受约束的子视图上设置一些名义上/下/左/右约束(我使用了“与最近邻的间距”并取消勾选“约束到边距”,然后单独单击每个约束,转到大小检查器,并在构建时勾选占位符/删除。这意味着自动布局仍然控制整个笔尖,但特定的子视图没有任何约束。之后我发现我能够以编程方式更改子视图的大小和原点,而不会像我以前那样收到“无法同时满足约束:NSIBPrototypingLayoutConstraint”警告消息。

于 2015-05-07T09:08:44.787 回答