For many applications
that work with text, using
NSTextView as the
frontend interface to the text provides a great deal of
functionality. This is by far the easiest way of working with the
text system: you only need to drop a text view into your interface
using Interface Builder, and you’re ready to go.
NSTextView’s APIs as the
sole means of working with the text system does not offer the
flexibility that can be achieved by assembling the individual
components manually. By starting with an
NSTextStorage object and adding layout managers,
text containers, and text views, document layouts can have multiple
columns and pages, have irregular areas of text, or present the same
text in two different layouts.
Before exploring the manually assembly of text components, consider these rules that tell you what you can and cannot do:
A text storage object may have one or more layout manager objects that it manages.
Each layout manager instance may manage one or more instances of
Each text container has exactly one text view associated with it.
By varying the structure of the network with respect to the first two rules, you can create the possibilities mentioned earlier.
Several methods in
NSTextContainer facilitate assembly and management
of the object network.
This class offers the following methods for managing its layout managers:
Adds the specified layout manager to the list of ...