我想改变NSAttributedString中的书写方向,但是我很难弄清楚如何做到这一点。
CTFontRef fontRef = CTFontCreateWithName((CFStringRef)@"ArialRoundedMTBold", 16, NULL);
NSDictionary *attrDictionary = [NSDictionary dictionaryWithObjectsAndKeys:(__bridge id)fontRef,(NSString *)kCTFontAttributeName, nil];
CFRelease(fontRef);
NSAttributedString *attString=[[NSAttributedString alloc] initWithString:self.stringMap attributes:attrDictionary];
self.attString = attString;
这是我初始化NSAttributedString的代码,我了解常量kCTWritingDirectionRightToLeft,感觉需要把它放在某个地方,但我不知道具体在哪里和如何使用。
有人有什么建议吗?
NSWritingDirectionAttributeName
:https://developer.apple.com/library/ios/documentation/uikit/reference/NSAttributedString_UIKit_Additions/Reference/Reference.html - LarmeNSWritingDirectionAttributeName
,对象:@(1)
。 - Larme