我正在尝试使插入的视图填充它插入的容器视图,但是我得到了
无效参数不满足:[constraint isKindOfClass:[NSLayoutConstraint class]]
- (void)insertedView:(NSView *)insertedView needsToFillContainerView:(NSView *)containerView {
[containerView addSubview:insertedView];
[containerView setTranslatesAutoresizingMaskIntoConstraints:NO];
[containerView addConstraints:@[
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[insertedView]|"
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(insertedView)],
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[insertedView]|"
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(insertedView)]
]
];
}
基本上我要插入的一个视图是从 VC 加载的