Closed DJSubj closed 7 years ago
代码贴出来下
@gsdios
_descLab = [UILabel labelWithFont:15.0 TextColor:DJ_BLACK_COLOR Text:@""]; _descLab.numberOfLines = 0; _descLab.isAttributedContent = YES;
_descLab.sd_layout .leftSpaceToView(_titleLab, 10) .topSpaceToView(self.contentView, 15) .rightSpaceToView(self.contentView, 15) .autoHeightRatio(0);
[self setupAutoHeightWithBottomView:_descLab bottomMargin:15];
NSMutableParagraphStyle paragraph = [[NSMutableParagraphStyle alloc] init]; paragraph.lineSpacing = 10;//行间距 NSMutableAttributedString attr = [[NSMutableAttributedString alloc] initWithString:model.desc]; [attr addAttribute:NSParagraphStyleAttributeName value:paragraph range:NSMakeRange(0, model.desc.length)]; _descLab.attributedText = attr;
我也是这个问题,设置行间距,如果是多行的话正确,如果只有一行则文字距离顶部有一段距离
@DJSubj 同样的问题,label设置了自定义行间距后,单行显示会多一个行高度;多行显示却没有,这是一个bug。
我设置了label的isAttributedContent为YES,行间距设置为10,一部分cell只有一行文字,一部分cell多行文字,问题是:一行文字的cell,第一个cell布局正确,后面的其它的cell高度都会加上一个行间距;多行文字的cell布局没毛病