| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.5 and later. |
| Companion guide | |
| Declared in | NSTreeNode.h |
NSTreeNode simplifies the creation and management of trees of objects. Each tree node represents a model object. A tree node with nil as its parent node is considered the root of the tree.
– representedObject
– indexPath
– isLeaf
– childNodes
– mutableChildNodes
– descendantNodeAtIndexPath:
– parentNode
Creates and returns a tree node that represents the specified object.
+ (id)treeNodeWithRepresentedObject:(id)modelObject
The object the tree node represents.
An initialized tree node that represents modelObject.
NSTreeNode.hReturns an array containing receiver’s child nodes.
- (NSArray *)childNodes
An array containing the receiver’s child nodes.
NSTreeNode.hReturns the receiver’s descendent at the specified index path.
- (NSTreeNode *)descendantNodeAtIndexPath:(NSIndexPath *)indexPath
An index path specifying a descendent of the receiver.
A tree node, or nil if the node does not exist.
NSTreeNode.hReturns the position of the receiver relative to its root parent.
- (NSIndexPath *)indexPath
An index path that represents the receiver’s position relative to the tree’s root node.
NSTreeNode.hInitializes a newly allocated tree node that represents the specified object.
- (id)initWithRepresentedObject:(id)modelObject
The object the tree node represents.
An initialized tree node that represents modelObject.
NSTreeNode.hReturns whether the receiver is a leaf node.
- (BOOL)isLeaf
YES if the receiver is a leaf node (has no child nodes), otherwise NO.
NSTreeNode.hReturns a mutable array that provides read-write access to the receiver’s child nodes.
- (NSMutableArray *)mutableChildNodes
A mutable array that provides read-write access to the receiver’s child nodes.
Nodes that are inserted into this array have their parent nodes set to the receiver. Nodes that are removed from this array automatically have their parent node set to nil. The array that is returned is observable using key-value observing.
NSTreeNode.hReturns the receiver’s parent node.
- (NSTreeNode *)parentNode
The receiver’s parent node.
NSTreeNode.hReturns the object the tree node represents.
- (id)representedObject
The object the tree node represents.
NSTreeNode.hSorts the receiver’s subtree using the values of the represented objects with the specified sort descriptors.
- (void)sortWithSortDescriptors:(NSArray *)sortDescriptors recursively:(BOOL)recursively
Array of sort descriptors specifying how to sort the represented objects.
A Boolean that specifies whether the child nodes should be sorted recursively.
All the represented objects in the child nodes must be key-value coding compliant for the keys specified in the sort descriptors.
NSTreeNode.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-07-13)