UILabel文字行间距

- (NSAttributedString *)getAttributedStringWithString:(NSString *)string lineSpace:(CGFloat)lineSpace {

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string];

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];

paragraphStyle.lineSpacing = lineSpace; // 调整行间距

NSRange range = NSMakeRange(0, [string length]);

[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range];

return attributedString;

}

你可能感兴趣的:(UILabel文字行间距)