UILabel 设置行间距和字间距

NSMutableAttributedString *attributedString =  [[NSMutableAttributedString alloc] initWithString:self.label.text attributes:@{NSKernAttributeName : @(1.5f)}];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
// 行间距
[paragraphStyle setLineSpacing:6];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, self.label.text.length)];
[self.label setAttributedText:attributedString];

self.label.numberOfLines = 0;
[self.label sizeToFit];
[self.scrollView addSubview:self.label];
PCH_LazyLoadingBlock(UIView, bottomView, {
})

你可能感兴趣的:(UILabel 设置行间距和字间距)