The User-Interface Layer: NSTextView Class

The vast majority of applications interact with the text system through one class: NSTextView. An NSTextView object provides a rich set of text-handling features and can:

The interface that this class declares (and inherits from its superclass NSText) lets you programmatically:

NSTextView objects are used throughout the Cocoa user interface to provide standard text input and editing features.

An NSTextView object is a convenient package of the most generally useful text-handling features. If the features of the NSTextView class satisfy your application’s requirements and you need more programmatic control over the characters and attributes that make up the text, you’ll have to learn something about the object that stores this data, NSTextStorage.

One of the design goals of NSTextView is to provide a comprehensive set of text-handling features so that you should rarely need to create a subclass. In its standard incarnation, NSTextView creates the requisite group of objects that support the text system—NSTextContainer, NSLayoutManager, and NSTextStorage objects. Here are the major features that NSTextView adds to those of NSText: