how to set NSMutableParagraphStyle firstLineHeadIndent for just first paragraph

980 Views Asked by At

I want set firstLineHeadIndent for only first paragraph for a multi-paragraph UILabel, how can I do

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

There are 1 best solutions below

0
On BEST ANSWER

Try to use smaller range:

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