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.h
Returns an array containing receiver’s child nodes.
- (NSArray *)childNodes
An array containing the receiver’s child nodes.
NSTreeNode.h
Returns 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.h
Returns 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.h
Initializes 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.h
Returns whether the receiver is a leaf node.
- (BOOL)isLeaf
YES
if the receiver is a leaf node (has no child nodes), otherwise NO
.
NSTreeNode.h
Returns 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.h
Returns the receiver’s parent node.
- (NSTreeNode *)parentNode
The receiver’s parent node.
NSTreeNode.h
Returns the object the tree node represents.
- (id)representedObject
The object the tree node represents.
NSTreeNode.h
Sorts 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)