O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSTextContainer — Mac OS X 10.0

Synopsis

This class is responsible for defining a region in which text will be laid out. The class NSLayoutManager manages a set of NSTextContainer objects and controls how text should fill these text containers. An NSTextContainer object, in turn, owns an instance of NSTextView that is responsible for putting the text up on screen. The default implementation of NSTextContainer defines a rectangular region of text; however, subclasses may be implemented to provide irregular shaped regions for text. In terms of the Model-View-Controller pattern, NSTextStorage is the model, NSTextView is the view, and NSLayoutManager and NSTextContainer serve as controllers between the data layer and the view layer. For more information on Cocoa’s text layout engine, see Chapter 5.

image with no caption

@interface NSTextContainer : NSObject <NSCoding>
                                  // Initializers
   - (id)initWithContainerSize:(NSSize)size;
                                  // Accessor Methods
   - (void)setLineFragmentPadding:(float)pad;
   - (float)lineFragmentPadding;
   - (void)setLayoutManager:(NSLayoutManager *)layoutManager;
   - (NSLayoutManager *)layoutManager;
   - (void)setHeightTracksTextView:(BOOL)flag;
   - (BOOL)heightTracksTextView;
   - (void)setWidthTracksTextView:(BOOL)flag;
   - (BOOL)widthTracksTextView;
   - (void)setTextView:(NSTextView *)textView;
   - (NSTextView *)textView;
   - (void)setContainerSize:(NSSize)size;
 - (NSSize) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required