Class

NSTreeNode

A node in a tree of nodes.

Declaration

@interface NSTreeNode : NSObject

Overview

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.

Topics

Creating tree nodes

+ treeNodeWithRepresentedObject:

Creates and returns a tree node that represents the specified object.

- initWithRepresentedObject:

Initializes a newly allocated tree node that represents the specified object.

Getting information about a node

representedObject

The object the tree node represents.

indexPath

The position of the receiver relative to its root parent.

leaf

A Boolean that indicates whether the receiver is a leaf node.

childNodes

An array containing receiver’s child nodes.

mutableChildNodes

A mutable array that provides read-write access to the receiver’s child nodes.

- descendantNodeAtIndexPath:

Returns the receiver’s descendent at the specified index path.

parentNode

The receiver’s parent node.

Sorting the subtree

- sortWithSortDescriptors:recursively:

Sorts the receiver’s subtree using the values of the represented objects with the specified sort descriptors.

Relationships

Inherits From

See Also

Tree-Based Data

Navigating Hierarchical Data Using Outline and Split Views

Build a structured user interface that simplifies navigation in your app.

NSTreeController

A bindings-compatible controller that manages a tree of objects.