- (void)viewDidLoad
{
[super viewDidLoad];
//? --------- attributedString測試:行間距為8 ---------------------------
NSString *text = @"attributedString測試:行間距為8。彩虹網(wǎng)絡(luò)卡福利費綠調(diào)查開房;卡法看得出來分開了的出口來反饋率打開了房;快煩死了;了; 調(diào)查開房;;v單純考慮分離開都快來反饋來看發(fā)v離開的積分房積分jdhflgfkkvvm.cm。attributedString測試:行間距為8。彩虹網(wǎng)絡(luò)卡福利費綠調(diào)查開房;卡法看得出來分開了的出口來反饋率打開了房;快煩死了;了; 調(diào)查開房;;v單純考慮分離開都快來反饋來看發(fā)v離開的積分房積分jdhflgfkkvvm.cm。";
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:8];
UIColor *color = [UIColor blackColor];
NSAttributedString *string = [[NSAttributedString alloc] initWithString:text attributes:@{NSForegroundColorAttributeName : color, NSParagraphStyleAttributeName: paragraphStyle}];
UILabel *label = [UILabel new];
[self.view addSubview:label];
label.attributedText = string;
label.sd_layout
.leftSpaceToView(self.view, 10)
.rightSpaceToView(self.view, 10)
.topSpaceToView(self.view, 70)
.autoHeightRatio(0);
// 標注lable的text為attributedString
label.isAttributedContent = YES;
//? --------- attributedString測試:行間距為8 ---------------------------
}