如何为第一段设置NSMutableParagraphStyle firstLineHeadIndent

时间:2015-06-15 04:04:11

标签: ios nsparagraphstyle

我想将firstLineHeadIndent设置为多段UILabel的第一段,我该怎么办

NSMutableParagraphStyle *paragraphStype = [[NSMutableParagraphStyle alloc] init];
paragraphStype.firstLineHeadIndent = 10.0f;
[att addAttribute:NSParagraphStyleAttributeName value:paragraphStype range:NSMakeRange(0, att.length)];

1 个答案:

答案 0 :(得分:0)

尝试使用较小的范围:

NSMutableParagraphStyle *paragraphStype = [[NSMutableParagraphStyle alloc] init];
paragraphStype.firstLineHeadIndent = 10.0f;
[att addAttribute:NSParagraphStyleAttributeName value:paragraphStype range:NSMakeRange(0, 10)];