iOS 改变 UILable 行间距

UILabel *intro = [[UILabel alloc] initWithFrame:CGRectMake(10, 64, 300, 160)];

intro.font = [UIFont systemFontOfSize:14.0];

intro.numberOfLines = 0;

NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:intro.text ];

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

[paragraphStyle setLineSpacing:7];

[attStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [intro.text length])];

intro.attributedText = attStr;

[intro sizeToFit];

你可能感兴趣的:(iOS 改变 UILable 行间距)