gsdios / SDAutoLayout

One line of code to implement automatic layout. 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于做最简单易用的AutoLayout库。The most easy way for autoLayout. Based on runtime.
MIT License
5.9k stars 1.28k forks source link

isAttributedContent 的问题 #166

Closed aimm closed 7 years ago

aimm commented 7 years ago
  1. 先设置 _priceLabel.isAttributedContent = YES ;
  2. 布局完成后,设置 [_priceLabel setMaxNumberOfLinesToShow:1]; 2行就没事 1行就有问题了
  3. 设置 _priceLabel.attributedText = attributedPriceString; 经过以上3步,会使 label 位置向上移动,去掉 最大行数限制或行数>1就没事了,求解
gsdios commented 7 years ago

富文本不能设置最大显示行数,因为富文本的行高和行间距都是可以自己定义的,需要自己计算具体行高然后设置maxHeight而不是设置最大显示行数