ios NSAttributedString firstLineHeadIndent bug

时间:2015-08-03 11:46:59

标签: nsattributedstring

我尝试使用FirstLineHeadIndent,但是当我使用时,该字符串将被截断。

NSString *string = @"hello,i am aaa,123456 my name is";
UIFont *textFont = [UIFont systemFontOfSize:15];
self.textView = [UILabel new];
_textView.backgroundColor = [UIColor clearColor];
[self.view addSubview:_textView];
_textView.numberOfLines = 0;

NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.lineHeightMultiple = 1.4;
[paragraphStyle setLineSpacing:4];
[paragraphStyle setFirstLineHeadIndent:30];
[paragraphStyle setAlignment:NSTextAlignmentJustified];
[paragraphStyle setLineBreakMode:NSLineBreakByWordWrapping];


NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:string attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:textFont,NSForegroundColorAttributeName:[UIColor darkGrayColor]}];
[_textView setAttributedText:string];

拦截的结果是你好,我是aaa,123456我的。

关于第一线收回,我错了吗?谢谢!

0 个答案:

没有答案