< Previous PageNext Page > Hide TOC

Creating a Subclass of NSTextStorage

NSTextStorage isn’t a fully concrete class; rather, it is the abstract superclass of a class cluster, as described in “Class Clusters”. It defines the storage for its NSLayoutManager objects and implements some methods, but doesn’t provide the primitive attributed string methods to subclasses. A subclass must define the storage for its attributed string, typically as an instance variable of type NSMutableAttributedString, override init and define its own initialization methods (or define constructors in Java), and implement the primitive methods of both NSAttributedString and NSMutableAttributedString. The Objective-C primitive methods are:

The Java methods are:

Beyond these requirements, if a subclass overrides or adds any methods that change its characters or attributes directly, those methods must invoke edited:range:changeInLength: (in Java, editedInRange) after performing the change in order to keep the change-tracking information up to date. See the description of this method for more information.



< Previous PageNext Page > Hide TOC


© 1997, 2005 Apple Computer, Inc. All Rights Reserved. (Last updated: 2005-08-11)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.