_infoLabel = [UILabel createNormalLabelWithTitle:@"设置了下面属性就可以换行了"];
// 限制宽
_infoLabel.preferredMaxLayoutWidth = ScreenWidth - 40*UIRate;
[_infoLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
_infoLabel.numberOfLines = 0;
[holdView addSubview:_infoLabel];
[_infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(holdView);
}];
Masonry布局UILabel换行
最新推荐文章于 2021-07-27 08:45:55 发布