Instance Method

lineBreakByHyphenatingBeforeIndex:withinRange:

Returns the index of the closest character before the given index, and within the given range, that can be placed on a new line by hyphenating.

Declaration

- (NSUInteger)lineBreakByHyphenatingBeforeIndex:(NSUInteger)location withinRange:(NSRange)aRange;

Parameters

location

The location in the attributed string.

aRange

The range.

Return Value

Returns the index of the closest character before index within aRange, that can be placed on a new line by hyphenating. Returns NSNotFound if no line break by hyphenation is possible before index.

Discussion

In other words, during text layout, finds the appropriate line break by hyphenation (the character index at which the hyphen glyph should be inserted) when the character at index won’t fit on the same line as the character at the beginning of aRange.

Raises an NSRangeException if index or any part of aRange lies beyond the end of the receiver’s characters.

See Also

Calculating Linguistic Units

- doubleClickAtIndex:

Returns the range of characters that form a word (or other linguistic unit) surrounding the given index, taking language characteristics into account.

- lineBreakBeforeIndex:withinRange:

Returns the appropriate line break when the character at the index won’t fit on the same line as the character at the beginning of the range.

- nextWordFromIndex:forward:

Returns the index of the first character of the word after or before the given index.