Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

NSTextView Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in Mac OS X v10.0 and later.
Declared in
NSTextView.h
Companion guides

Class at a Glance

NSTextView is the front-end component of the Application Kit’s text system. It displays and manipulates text laid out in an area defined by an NSTextContainer object and adds many features to those defined by its superclass, NSText. Many of the methods that you’ll use most frequently are declared by the superclass; see the NSText class specification for details.

Creation

Instances of this class can be created using Interface Builder or using one of the following methods:

initWithFrame:

Creates an NSTextView instance along with all of its supporting objects.

initWithFrame:textContainer:

Designated initializer.

Commonly Used Methods

The methods most commonly used with NSTextView objects are declared in NSText, the superclass. These methods provide access to the other major components of the text system:

textStorage

Returns the associated NSTextStorage object.

textContainer

Returns the associated NSTextContainer object.

layoutManager

Returns the associated NSLayoutManager object.

Overview

NSTextView is the front-end class to the Application Kit’s text system. It draws the text managed by the back-end components and handles user events to select and modify its text. NSTextView 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 NSTextView is a subclass of NSText—which declares the most general Cocoa interface to the text system—NSTextView adds major features beyond the capabilities of NSText.

About Delegate Methods

NSTextView communicates with its delegate through methods declared both by NSTextView and by its superclass, NSText. See the NSText class specification for those other delegate methods. Note that all delegation messages come from the first text view.

Adopted Protocols

NSTextInput
NSUserInterfaceValidations

Tasks

Initializing

Registering Services Information

Accessing Text System Objects

Setting Graphics Attributes

Controlling Display

Inserting Text

Setting Behavioral Attributes

Using the Ruler

Managing the Selection

Managing the Pasteboard

Setting Text Attributes

Clicking and Pasting

Undo Support

Methods for Subclasses to Use or Override

Working With the Spelling Checker

NSRulerView Client Methods

Assigning a Delegate

Dragging

Speaking Text

Working with Panels