Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the attribute dictionaries from a NSAttributedString

Tags:

objective-c

How can I obtain the attributes of an NSAttributedString?

I thought using enumerateAttributesInRange:NSMakeRange(0, str.length) and then saving every attributes in a NSMutableDictionaries but I'd like to know if exists a better way.

EDIT------ My problem is that I have a NSAttributedString and i want to use this function on its attributes...

CTFramesetterSuggestFrameSizeWithConstraints(framesetter,range, __ATTRIBUTES__, size , NULL);
like image 291
MatterGoal Avatar asked Nov 24 '22 03:11

MatterGoal


1 Answers

 NSDictionary *attributesFromString = [string attributesAtIndex:0 longestEffectiveRange:nil inRange:NSMakeRange(0, string.length)];
like image 65
Md. Ibrahim Hassan Avatar answered Nov 26 '22 16:11

Md. Ibrahim Hassan