美文网首页
UILable 设置最大右边距离,满足排列超出frame

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

作者: 就用帅气点的昵称吧 | 来源:发表于2021-01-22 14:18 被阅读0次

[_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

      本文链接:https://www.haomeiwen.com/subject/usiszktx.html