NSString
*textStr =
@“”;
//设置边框 颜色、先款、圆角
self.detailLab.layer.borderColor
= [UIColoryellowColor].CGColor;
self.detailLab.layer.borderWidth
=
2;
self.detailLab.layer.cornerRadius = 6;
self.detailLab.layer.cornerRadius = 6;
self.detailLab.layer.masksToBounds
= YES;
self.detailLab.text
= textStr;
//设置Lable的行间距setLineSpacing、段间距setHeadIndent、首行缩进setFirstLineHeadIndent
NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle
alloc]
init];
[paragraphStyle1
setLineSpacing:10.0];
[paragraphStyle1 setFirstLineHeadIndent:10];
[paragraphStyle1 setHeadIndent:5];
NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:self.detailLab.text attributes:@{NSParagraphStyleAttributeName:paragraphStyle1}];
[paragraphStyle1 setFirstLineHeadIndent:10];
[paragraphStyle1 setHeadIndent:5];
NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:self.detailLab.text attributes:@{NSParagraphStyleAttributeName:paragraphStyle1}];
self.detailLab.attributedText
= attributedString1;
//设置行间距后适配高度显示
[_detailLab
sizeToFit];