masonry 设置多行Label

来源:互联网 发布:剑三 点绛唇捏脸数据 编辑:程序博客网 时间:2024/06/07 20:19

//详情
self.detailLabel = [UILabel new];
self.detailLabel.font = [UIFont systemFontOfSize:15];
self.detailLabel.numberOfLines = 0;
self.detailLabel.preferredMaxLayoutWidth = WIDTH(self);//要是设置多行Label的话,必须设置此属性
self.detailLabel.backgroundColor = [UIColor whiteColor];
[self addSubview:self.detailLabel];
[self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.footTitleBackView.mas_bottom).offset(5);
make.left.and.right.mas_equalTo(0);
make.bottom.mas_equalTo(self.mas_bottom);
}];
[self.detailLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];

0 0
原创粉丝点击