TextKit

Manage text storage and perform custom layout of text-based content in your app's views.

Overview

TextKit provides a number of classes to control the layout of text, such as NSTextStorage, NSLayoutManager, and NSTextContainer.

Additionally, NSAttributedString objects are used extensively throughout TextKit. The NSTextStorage class is a subclass of NSMutableAttributedString, and many of the TextKit classes (for example, the classes listed in Formatted Content) focus on creating complex NSAttributedString instances. Use these classes to specify your text's format.

Most of the time, you can use TextKit to fine tune the formatting and layout of a NSTextView by modifying the view's textContainer, layoutManager, or textStorage properties. If you need more control, you can also use TextKit to build your own custom text controls.

Topics

Data Management

NSTextDelegate

A set of optional methods implemented by the delegate of an NSText object to edit text and change text formats.

NSTextStorage

The fundamental storage mechanism of TextKit.

NSTextStorageDelegate

A set of optional methods implemented by delegates of NSTextStorage objects to handle text-edit processing.

Layout

NSLayoutManager

An object that coordinates the layout and display of characters held in an NSTextStorage object.

NSLayoutManagerDelegate

A set of optional methods implemented by delegates of NSLayoutManager objects.

NSTextContainer

A region where text is laid out.

NSTextBlock

A block of text laid out in a subregion of the text container.

NSATSTypesetter

A concrete subclass of NSTypesetter that places glyphs during the text layout process.

NSTypesetter

An abstract class that performs various type layout tasks.

NSTextLayoutOrientationProvider

A set of methods that define the orientation of text for an object.

Formatted Content

NSParagraphStyle

The paragraph or ruler attributes used by an attributed string.

NSMutableParagraphStyle

An object that enables changing the values of the subattributes in a paragraph style attribute.

NSTextTable

An object that represents a text table as a whole.

NSTextTableBlock

A text block that appears as a cell in a text table.

NSTextTab

A tab in an NSParagraphStyle object, storing an alignment type and location.

NSTextList

A section of text that forms a single list.

Attachments

NSTextAttachment

The values for the attachment attributes of attributed strings and related objects.

NSTextAttachmentCell

An object that implements the functionality of the text attachment cell protocol.

NSTextAttachmentCell

A set of methods that declares the interface for objects that draw text attachment icons and handle mouse events on their icons.

NSTextAttachmentContainer

A set of methods that defines the interface to text attachment objects from NSLayoutManager.

Glyphs

NSGlyph

The type used to specify glyphs.

NSGlyphStorage

A set of methods that a glyph storage object must implement to interact properly with NSGlyphGenerator.

NSGlyphGenerator

An object that performs the initial, nominal glyph generation phase in the layout process.

NSGlyphInfo

A glyph attribute in an attributed string.

NSGlyphRelation

Constants that are used for calculating the layout of stacked glyphs.

Deprecated
Glyph Attributes

Attributes that are used only inside the glyph generation machinery, but must also be shared between components.

Deprecated
NSConvertGlyphsToPackedGlyphs

Prepares a set of glyphs for processing by character-based routines.

Deprecated

Input Management

NSTextInput

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

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.

See Also

Text

Text Display

Display text and check spelling.

Fonts

Manage the fonts used to display text.