A view that draws text and handles user interactions with that text.
- macOS 10.0+
NSText class is the front-end class to the AppKit text system. The class draws the text managed by the back-end components and handles user events to select and modify its text, in addition to supporting rich text, attachments, input management and key binding, and marked text attributes.
NSText is the principal means to obtain a text object that caters to almost all needs for displaying and managing text at the user interface level. While
NSText is a subclass of the
NSText class—which declares the most general Cocoa interface to the text system—
NSText adds major features beyond the capabilities of
NSText. You can also do more powerful and more creative text manipulation (such as displaying text in a circle) using
NSText, and related classes.
You are more likely to use the
NSText class than the
NSText class. It is also important to remember that
NSText conforms to a large number of protocols, the methods of which are available to instances of the
NSText communicates with its delegate through methods declared both by the
NSText and by its superclass’s protocol,
NSText. All delegation messages come from the first text view. To fully understand how to use this class, read Cocoa Text Architecture Guide and Text System User Interface Layer Programming Guide.