ios label首行缩进

不要说话,就是干-------努尔哈赤

NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
// 对齐方式
style.alignment = NSTextAlignmentJustified;
// 首行缩进
style.firstLineHeadIndent = 12.0f;
// 头部缩进
style.headIndent = 12.0f;
// 尾部缩进
style.tailIndent = -12.0f;
NSAttributedString *attrText = [[NSAttributedString alloc] initWithString:title attributes:@{ NSParagraphStyleAttributeName : style}];
UILabel *label = [[UILabel alloc] initWithFrame:someFrame];
label.numberOfLines = 0;
label.attributedText = attrText;

你可能感兴趣的:(ios label首行缩进)