Determines the graphical offset or offsets for a string index.
- iOS 3.2+
- macOS 10.5+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
- Core Text
The line from which the offset is requested.
The string index corresponding to the desired position.
On output, the secondary offset along the baseline for
char. When a single caret is sufficient for a string index, this value will be the same as the primary offset, which is the return value of this function. May be
The primary offset along the baseline for
0 if the line does not support string access.
This function returns the graphical offset or offsets corresponding to a string index, suitable for movement between adjacent lines or for drawing a custom caret. For moving between adjacent lines, the primary offset can be adjusted for any relative indentation of the two lines; a
CGPoint constructed with the adjusted offset for its
x value and
0 for its
y value is suitable for passing to
CTLine. For drawing a custom caret, the returned primary offset corresponds to the portion of the caret that represents the visual insertion location for a character whose direction matches the line's writing direction.