contentLb =[[UILabel alloc]initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH -20, MAXFLOAT)];
contentLb.numberOfLines =0;
contentLb.text =content;
NSMutableAttributedString *str =[[NSMutableAttributedString alloc]initWithString:content];
NSMutableParagraphStyle *style =[[NSMutableParagraphStyle alloc]init];
//设置行距
[style setLineSpacing:10];
//设置段落开始距
[style setFirstLineHeadIndent:30];
[str addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, contentLb.text.length)];
contentLb.attributedText =str;
[contentLb sizeToFit];
UILabel设置行距和每段初始距离
最新推荐文章于 2024-09-18 14:25:23 发布