调整label行距需要用label的attributedText属性,不需要用text属性了,如下:
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:newString];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 5; // 调整行间距
NSRange range = NSMakeRange(0, [newString length]);
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range];
self.detailLab.attributedText = attributedString;