iOS 改变 UILable 行间距
2017-04-26 本文已影响18人
Bager
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];