这是我的代码:
UIView *nameRightView = ({
UIView *nameRightView = [[UIView alloc] init];
nameRightView.bounds = CGRectMake(0, 0, 100, 34);
nameRightView.backgroundColor = [UIColor redColor];
nameTextField.rightView = nameRightView;
nameTextField.rightViewMode = UITextFieldViewModeAlways;
UIImageView *closeIv = ({
UIImageView *closeIv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"subscribe_match_filter_delete_hover"]];
// closeIv.frame = CGRectMake(7, 0, 34, 34); 用框架,没关系!
[nameRightView addSubview:closeIv];
[closeIv mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(nameRightView.mas_top);
make.right.equalTo(nameRightView.mas_right).width.offset(7);
make.bottom.equalTo(nameRightView.mas_bottom);
make.width.equalTo(@34);
}];
closeIv;
});
错误日志:
*** Assertion failure in -[MASViewConstraint addConstraintWithLayoutAttribute:], /Users/donglei/Documents/Ios/BMLOL4.4.0/Pods/Masonry/Masonry/MASViewConstraint.m:207