UILable 设置最大右边距离,满足排列超出frame

[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {

make.left.equalTo(_delBtn.mas_right).offset(10);

make.right.mas_lessThanOrEqualTo(_selectImageView.mas_left).offset(-5);//最大右边距


make.height.mas_offset(16);

make.centerY.mas_equalTo(self);

        }];

注意设置了最大或者最小值必须设置优先级:

    [_titleLabel setContentHuggingPriority:240 forAxis:UILayoutConstraintAxisHorizontal];

    [_titleLabel setContentCompressionResistancePriority:720 forAxis:UILayoutConstraintAxisHorizontal];

//优先显示zanLabel

    [self.zanLabel setContentHuggingPriority:245 forAxis:UILayoutConstraintAxisHorizontal];

    [self.zanLabel setContentCompressionResistancePriority:725 forAxis:UILayoutConstraintAxisHorizontal];

你可能感兴趣的:(UILable 设置最大右边距离,满足排列超出frame)