1

私はxibと一緒にストーリーボードを使用しています。

UIViewControllerストーリーボードからロードし、UIViewxib からロードしました。ストーリーボードにサブビューとしてxibを追加し、UIViewController次のように下部の制約を設定しようとしています:

TransactionsPickerViewController *_picker = [[TransactionsPickerViewController alloc] initWithNibName:nil bundle:nil];
[self.view addSubview:picker.view];

NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:picker.view
                                                            attribute:NSLayoutAttributeBottom
                                                            relatedBy:NSLayoutRelationEqual
                                                            toItem:self.view
                                                            attribute:NSLayoutAttributeBottom
                                                            multiplier:1.0f constant:0.0f];
[self.view addConstraint:constraint];

デバッグ コンソールでこれが発生します。

Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want...

UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x1090509e0 UIView:0x109440be0.bottom == UIView:0x109619ba0.bottom>",
    "<NSAutoresizingMaskLayoutConstraint:0x109052400 h=-&- v=-&- UIView:0x109440be0.midY == UIView:0x109619ba0.midY - 140>",
    "<NSAutoresizingMaskLayoutConstraint:0x109052470 h=-&- v=-&- UIView:0x109440be0.height == UIView:0x109619ba0.height - 280>"
)

これらの自動サイズ変更プロパティはどこから来ているのですか?それらを削除して機能させることはできますか? 基本的に、追加後にピッカービューを親ビューの下部に貼り付けたいと思っています。

xib ファイルで自動レイアウトを無効にしようとしましたが、何も変わりません。

4

1 に答える 1