Protocol

NSTextInput

A set of methods that text views must implement to interact properly with the text input management system.

Declaration

@protocol NSTextInput

Overview

NSTextView and its abstract superclass NSText are the only classes included in Cocoa that implement NSTextInput. To create another text view class, you can either subclass NSTextView (and not NSText, for historical reasons), or subclass NSView and implement the NSTextInput protocol.

Topics

Marked text

- hasMarkedText

Returns a Boolean value indicating whether or not the receiver has marked text.

Required.

Deprecated
- markedRange

Returns the range of the marked text.

Required.

Deprecated
- selectedRange

Returns the range of selected text.

Required.

Deprecated
- setMarkedText:selectedRange:

Replaces currently marked text in the receiver’s text storage with the given string and sets the selection to the given range, computed from the beginning of the marked text.

Required.

Deprecated
- unmarkText

Removes any marking from pending input text and disposes of the marked text as it wishes. The text view should accept the marked text as if it had been inserted normally.

Required.

Deprecated
- validAttributesForMarkedText

Returns an array of names for the attributes supported by the receiver.

Required.

Deprecated

Text storage

- attributedSubstringFromRange:

Returns an attributed string derived from the given range in the receiver's text storage.

Required.

Deprecated
- insertText:

Inserts the given string into the receiver’s text storage.

Required.

Deprecated

Character coordinates

- characterIndexForPoint:

Returns the index of the character whose frame rectangle includes the given point.

Required.

Deprecated
- firstRectForCharacterRange:

Returns the first frame rectangle for characters in the given range, in screen coordinates.

Required.

Deprecated

Key bindings

- doCommandBySelector:

Invokes the given selector if possible.

Required.

Deprecated

Other

- conversationIdentifier

Returns a number used to identify the receiver’s context to the input server.

Required.

Deprecated

Relationships

Conforming Types

See Also

Input Management

NSTextInputClient

A set of methods that text views must implement to interact properly with the text input management system.

NSTextInputContext

An object that represents the Cocoa text input system.

NSTextAlternatives

A list of alternative strings for a piece of text.