masonry 設置多行Label

//詳情
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];

發佈了26 篇原創文章 · 獲贊 4 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章