#define LINESPACE 20
UILabel
*label = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, 320,
200)];
[label
setBackgroundColor:[UIColor blackColor]];
[label
setTextColor:[UIColor whiteColor]];
[label
setNumberOfLines:0];
NSString
*labelText =
@"可以自己按照宽高,字体大小,来计算有多少行。。然后。。。每行画一个UILabel。。高度自己可以控制把这个写一个自定义的类。
";
NSMutableAttributedString
*attributedString = [[NSMutableAttributedString alloc]
initWithString:labelText];
NSMutableParagraphStyle
*paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle
setLineSpacing:LINESPACE];//调整行间距
[attributedString
addAttribute:NSParagraphStyleAttributeName value:paragraphStyle
range:NSMakeRange(0, [labelText length])];
label.attributedText
= attributedString;
[self.view
addSubview:label];
[label
sizeToFit];