从NSAttributedString获取属性词典

Mat*_*oal 5 objective-c

如何获取NSAttributedString的属性?

我想使用enumerateAttributesInRange:NSMakeRange(0, str.length)然后保存NSMutableDictionaries中的每个属性,但我想知道是否存在更好的方法.

编辑------我的问题是我有一个NSAttributedString,我想在它的属性上使用这个函数...

CTFramesetterSuggestFrameSizeWithConstraints(framesetter,range, __ATTRIBUTES__, size , NULL);
Run Code Online (Sandbox Code Playgroud)

jon*_*ypz -1

UITextView *t = [[UITextView alloc] init];
[t setAttributedText:a];
t.typingAttributtes
Run Code Online (Sandbox Code Playgroud)