lele8446 / CJLabel

A drop-in replacement for UILabel that supports NSAttributedString, rich text, display any view, links, select copy and more
MIT License
185 stars 27 forks source link

NSMutableParagraphStyle,行间距设置 #13

Closed sevenmylove520 closed 4 years ago

sevenmylove520 commented 4 years ago

NSMutableParagraphStyle行间距设置,没有效果

代码如下 NSMutableParagraphStyle *paragraphStyleLineS = [[NSMutableParagraphStyle alloc] init]; paragraphStyleLineS.lineSpacing = 2.0; // 设置行间距

[attributes setValue:paragraphStyleLineS forKey:NSParagraphStyleAttributeName];

configure.attributes = attributes;
lele8446 commented 4 years ago

行间距设置继承自系统属性,同一行字符中如果只是对中间指定字符设置行间距将不会生效。 你可以对每一行的第一个字符开始设置行间距,或者对全部文本统一设置行间距