UILabel更改行间距

更改Label行间距方法

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:subString];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:8];//设置行间距的值
            
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [subString length])];
[label setAttributedText:attributedString];
[label sizeToFit];

你可能感兴趣的:(UILabel更改行间距)