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) ...

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.