1
iOS 6 애플리케이션에서 속성 문자열을 허용하도록 UITextView를 설정했습니다.풍부한 UITextView에서 CoreText로 텍스트 정렬 단락?
단락의 텍스트 정렬 (좌우 가운데 맞춤)을 변경하려면 어떻게해야합니까?
다음 코드 :와 마지막 줄에
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] : 인식 할 수없는 선택기 예를 0x1559b2d0