来自NIB +自动布局的自定义视图

时间:2013-09-17 14:16:50

标签: ios autolayout nib loadnibnamed

我已经创建了一个笔尖,我使用以下代码加载自定义视图:

NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:[[self class] description] owner:nil options:nil];
self = topLevelObjects[0];

但是当我启用autolayout时,我收到此错误:

Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to install constraint on view.  Does the constraint reference something from outside the subtree of the view?  That's illegal. constraint:<NSLayoutConstraint:0xb99a580 UIView:0xb997990.bottom == UIView:0xb995b20.bottom> view:<UIView: 0xb995b20; frame = (0 0; 320 320); autoresize = W+H; layer = <CALayer: 0xb995b80>>'

我希望视图可以调整大小。我不想使用那些不可删除的自动布局大小限制。将其优先级设置为1不起作用。在超级视图中,我显然没有任何约束,我希望这种观点具有普遍性。

我该怎么做?

0 个答案:

没有答案