UILabel的行间距

一般解决办法(全部文本都设置可用,如果个别几行则此办法无效)

 NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc] initWithString:textString];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle setLineSpacing:8]; //调整行间距
    [attributeStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [attributeStr length])];
    label.attributedText = attributeStr;

你可能感兴趣的:(UILabel)