NSTextInsertionIndicator
A view that represents the insertion indicator in text.
Declaration
class NSTextInsertionIndicatorMentioned in
Overview
NSTextView and NSTextField both use NSTextInsertionIndicator to display the insertion indicator. You can use this indicator if you have your own text engine or need to display an indicator elsewhere.
To use the indicator, instantiate an NSTextInsertionIndicator, then add the view to your view hierarchy. Set the indicator view’s frame to where you want to display a text insertion indicator. The indicator has the same height as the indicator view’s frame, and centers horizontally within the indicator view’s frame.
The NSTextInsertionIndicator.DisplayMode specifies whether the indicator hides, remains visible, or blinks (automatic).
When set to NSTextInsertionIndicator.DisplayMode.automatic, the indicator stops blinking when you set the frame. The indicator starts blinking when the frame doesn’t change for a period of time. When the user dictates, the indicator displays a trailing glow when it is moved.
Set the NSTextInsertionIndicator.DisplayMode to NSTextInsertionIndicator.DisplayMode.automatic when your custom view becomes the first responder. When your custom view resigns first responder, set the displayMode to NSTextInsertionIndicator.DisplayMode.hidden to indicate that key events aren’t sent to your view.
By default the indicator’s color is textInsertionPointColor. You can set a different color.