Masonry 适配label多行

设置属性后,然后根据文本自动多行显示,无需设置标签高度约束

1 属性preferredMaxLayoutWidth,如:label.preferredMaxLayoutWidth = (WidthScreen - 10.0 * 2);

2 方法setContentHuggingPriority:forAxis:,如:[label setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];

3 属性numberOfLines,如:label.numberOfLines = 0;

4 自适应label多行显示时,无需设置label高度,即无需写以下代码:make.height.mas_equalTo(???); 

posted @ 2017-04-18 16:35  小屁孩~  阅读(2216)  评论(0编辑  收藏  举报