Instance Method

temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:

Returns the temporary attributes for the character at a given index, and by reference the maximum range over which the attributes apply.

Declaration

- (NSDictionary<NSAttributedStringKey, id> *)temporaryAttributesAtCharacterIndex:(NSUInteger)location longestEffectiveRange:(NSRangePointer)range inRange:(NSRange)rangeLimit;

Parameters

location

The index for which to return attributes. This value must not exceed the bounds of the receiver.

range

If not NULL, on output, contains the maximum range over which the attributes and values are the same as those at location, clipped to rangeLimit.

rangeLimit

The range over which to search for continuous presence of the attributes at location. This value must not exceed the bounds of the receiver.

Return Value

The attributes for the character at location.

Discussion

If you don’t need the longest effective range, it’s far more efficient to use the temporaryAttributesAtCharacterIndex:effectiveRange: method to retrieve the attribute value.

See Also

Managing Temporary Attribute Support

- addTemporaryAttributes:forCharacterRange:

Appends one or more temporary attributes to the attributes dictionary of the specified character range.

- addTemporaryAttribute:value:forCharacterRange:

Adds a temporary attribute with the given name and value to the characters in the specified range.

- setTemporaryAttributes:forCharacterRange:

Sets one or more temporary attributes for the specified character range.

- removeTemporaryAttribute:forCharacterRange:

Removes a temporary attribute from the list of attributes for the specified character range.

- temporaryAttribute:atCharacterIndex:effectiveRange:

Returns the value for the temporary attribute with a given name of the character at a given index, and by reference the range over which the attribute applies.

- temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:

Returns the value for the temporary attribute with a given name of the character at a given index, and by reference the maximum range over which the attribute applies.

- temporaryAttributesAtCharacterIndex:effectiveRange:

Returns the dictionary of temporary attributes for the character range specified in effectiveCharRange at character index charIndex.