I call the following selector on an existing NSAttributedStringwithout ranges kCTFontAttributeName:
NSAttributedString
kCTFontAttributeName
[attributedString enumerateAttribute:(NSString *) kCTFontAttributeName inRange:NSMakeRange(0, [attributedString length]) options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(id value, NSRange range, BOOL *stop) { NSLog(@"Attribute: %@, %@", value, NSStringFromRange(range)); }];
and I get the output below, but I expect not to get the output. Suggestions?
Attribute: (null), {0, 27} Attribute: (null), {27, 1} Attribute: (null), {28, 1} Attribute: (null), {29, 1} Attribute: (null), {30, 1}
Short answer? -enumerateAttribute:inRange:options:usingBlock:doesnβt do what you (or I, originally) thought it was.
-enumerateAttribute:inRange:options:usingBlock:
, , . . . , . value, , . , nil value.
value
nil
, , , , value nil. , ( ), , , value . , , , , value nil, value, .
, . , .
Source: https://habr.com/ru/post/1782618/More articles:C # add progress bar to textBox - c #Using Mono SGen Garbage Collector in C / C ++ Programs - c ++Can we have buttons in the validation template and how can we bind it to the ViewModel method? - commandhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1782616/dynamically-change-an-elements-top-position-based-on-height&usg=ALkJrhjo84rZGnIwmKKAbDQIpu0lnYktXgIPhone crashes while saving CoreData - iphoneHow many states has activity? - androidjquery ui css does not load and creates problems with asp.net mvc3 page (unexpected marker error) - jquery-uito get the name of a camel from the protocol buffer field - javaIs it possible to control overflow for jQuery UI Sortable helper? - jqueryUnexpected ClassCastException with findViewById - androidAll Articles