UITextView
withの正当化されたテキストを配置しようとしています。これは、太字と通常のフォントが必要なため、別NSMutableAttributedString
のNSMutableAttributedString
もので構成されているため、別のを追加します。これは私のものです:NSAttributedString
NSString
NSMutableAttributedString
NSAttributedString *one = [[NSAttributedString alloc] initWithString:@"abc"
attributes:boldDict];
NSAttributedString *two = [[NSAttributedString alloc] initWithString:@" def"
attributes:regularDict];
NSAttributedString *three = [[NSAttributedString alloc] initWithString:@" ghi"
attributes:boldDict];
NSMutableAttributedString *string =
[[NSMutableAttributedString alloc] initWithAttributedString:one];
[string appendAttributedString:two];
[string appendAttributedString:three];
私はこれを試しました:
[self.text_view setTextAlignment:NSTextAlignmentJustified]
この:
NSMutableParagraphStyle *paragraphStyles = [[NSMutableParagraphStyle alloc] init];
paragraphStyles.alignment = NSTextAlignmentJustified;
Dictionary *attributes = @{NSParagraphStyleAttributeName: paragraphStyles};
これを NSMutableAttributedString に適用しますが、どちらも機能しません。どうすればいいですか?