iOS 6 アプリケーションでは、属性付きの文字列を受け入れるように UITextView を設定しています。
段落のテキスト配置 (左 - 右 - 中央 - 両端揃え) を変更するにはどうすればよいですか?
次のコード:
NSMutableAttributedString *mutableAttributeString = [textView.attributedText mutableCopy];
CTTextAlignment alignment = kCTCenterTextAlignment;
CTParagraphStyleSetting settings[] = {kCTParagraphStyleSpecifierAlignment, sizeof(alignment), &alignment};
CTParagraphStyleRef paragraphStyle = CTParagraphStyleCreate(settings, sizeof(settings) / sizeof(settings[0]));
CFAttributedStringSetAttribute((CFMutableAttributedStringRef)mutableAttributeString, CFRangeMake(0, CFAttributedStringGetLength((CFMutableAttributedStringRef)mutableAttributeString)), kCTParagraphStyleAttributeName, paragraphStyle);
CFRelease(paragraphStyle);
textView.attributedText = mutableAttributeString;
最後の行でクラッシュ: -[__NSCFType headIndent]: unrecognized selector sent to instance 0x1559b2d0