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

NSTextStorage — Mac OS X 10.0

Synopsis

This subclass of NSMutableAttributedString is the data model for Cocoa’s text-handling system. NSTextStorage manages one or more NSLayoutManagers, which are responsible for determining how the text should be displayed. Two additional classes have an equally important role in the text-handling system, as does NSTextStorage: NSTextContainer and NSTextView. 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.

image with no caption

@interface NSTextStorage : NSMutableAttributedString
                                  // Accessor Methods
   - (void)setParagraphs:(NSArray *)paragraphs;
   - (NSArray *)paragraphs;
   - (void)setForegroundColor:(NSColor *)color;
   - (NSColor *)foregroundColor;
   - (void)setCharacters:(NSArray *)characters;
   - (NSArray *)characters;
   - (void)setAttributeRuns:(NSArray *)attributeRuns;
   - (NSArray *)attributeRuns;
   - (void)setDelegate:(id)delegate;
   - (id)delegate;
   - (void)setWords:(NSArray *)words;
   - (NSArray *)words;
   - (void)setFont:(NSFont *)font;
   - (NSFont *)font;
                                  // Instance Methods
   - (void)addLayoutManager:(NSLayoutManager *)obj;
   - (int)changeInLength;
   - (void)edited:(unsigned)editedMask 
                                 range:(NSRange)range 
                                 changeInLength:(int)delta;
   - (unsigned)editedMask;
   - (NSRange)editedRange;
 - (void) ...

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