NSMutableParagraphStyle无法正常工作

时间:2014-02-11 12:39:41

标签: ios uitextfield

我遇到NSMutableParagraphStyle

的问题
 NSMutableParagraphStyle *pageStyle = [[NSMutableParagraphStyle alloc] init];
 [pageStyle setLineSpacing:14];
 [pageStyle setAlignment:NSTextAlignmentJustified];
 [pageStyle setFirstLineHeadIndent:5];

 [pageString addAttribute:NSParagraphStyleAttributeName value:pageStyle range:NSMakeRange(0, self.pageText.length)];

 [pageString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Helvetica" size:20] range:NSMakeRange(0, self.pageText.length)];
 [pageString addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(0, self.pageText.length)];

 self.myTextView.attributedText = pageString;

所有这些都正常工作,除非

 [pageStyle setAlignment:NSTextAlignmentJustified];
 [pageStyle setFirstLineHeadIndent:5];

我该怎么办?

0 个答案:

没有答案