我在xib中使用故事板。
我UIViewController
从情节UIView
提要加载并从xib加载。我正在尝试将 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>"
)
这些自动调整大小的属性来自哪里,我可以摆脱它们以使其工作吗?Baically 我希望我的选择器视图在添加后坚持到父视图底部。
我试图在 xib 文件上禁用自动布局,但它没有改变任何东西。