Instance Method


Inserts aString into the receiver’s text at the insertion point if there is one, otherwise replacing the selection.


- (void)insertText:(id)insertString;



The string to insert. aString can be either an NSString object or an NSAttributedString object.


The inserted text is assigned the current typing attributes.

This method is the means by which text typed by the user enters an NSTextView. See the NSInputManager class and NSTextInput protocol specifications for more information.

This method is the entry point for inserting text typed by the user and is generally not suitable for other purposes. Programmatic modification of the text is best done by operating on the text storage directly. Because this method pertains to the actions of the user, the text view must be editable for the insertion to work.

See Also

Inserting Text


An array of locale identifiers representing input sources that are allowed to be enabled when the receiver has the keyboard focus.