characterIndexForInsertion(at:)
Returns a character index appropriate for placing a zero-length selection for an insertion point associated with the mouse at the given point.
Declaration
func characterIndexForInsertion(at point: NSPoint) -> IntParameters
- point:
The point for which to return an index, in view coordinates.
Return Value
The character index for the insertion point.
Discussion
This method should be used for insertion points associated with mouse clicks, drag events, and so forth. For other purposes, it is better to use NSLayoutManager methods.
The NSTextInput method characterIndexForPoint: is not suitable for this role; it is intended only for uses related to text input methods.
See Also
Managing the selection
selectedRangessetSelectedRange(_:)setSelectedRange(_:affinity:stillSelecting:)setSelectedRanges(_:affinity:stillSelecting:)selectionAffinityselectionGranularityinsertionPointColorupdateInsertionPointStateAndRestartTimer(_:)selectedTextAttributesmarkedTextAttributeslinkTextAttributesupdateCandidates()