0

次のコードを使用して、カスタム ビューをロードする nib を作成しました。

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

しかし、自動レイアウトを有効にすると、次のエラーが発生します。

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 に設定しても機能しませんでした。スーパービューでは、明らかに制約はありません。このビューを普遍的にしたいと考えています。

これどうやってするの?

4

0 に答える 0