# NSTreeController class documentation

Generated at 2026-02-17 21:02:56 +0000
Software documentation for the NSTreeController class
AppKit/NSTreeController.h
NSCoding
NSCopying
Description forthcoming.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
add:
sender
Adds a new objeect to the tree usin the newObject method. If the tree controller is in "object" mode, then newObject is called to add a new node.
addChild:
sender
Adds a child to the current selection using the newObject method. If the tree controller is in "object" mode, then newObject is called to add a new node.
addSelectionIndexPaths:
indexPaths
Adds the objects in the indexPaths array to the current selection.
alwaysUsesMultipleValuesMarker
BOOL that indicates if the controller returns the multiple values marker when multiple objects have been selected.
arrangedObjects
All objects managed by this tree controller.
avoidsEmptySelection
If `YES`, requires the content array to maintain a selection.
canAddChild
If `YES`, a child can be added.
canInsert
If `YES`, an object can be inserted.
canInsertChild
If `YES`, a child can be inserted.
childrenKeyPath
Key path for children of the node. This key must be key value compliant.
childrenKeyPathForNode:
node
children key path for the given NSTreeNode.
countKeyPath
Key value path for the flag which gives the count for the children of this node. The path indicated here must be key-value compliant. If count is enabled, then add:, addChild:, remove:, removeChild: and insert: are disabled. This key path is option since it can be determined by the array of children retuned by the childKeyPath. The mode the tree controller is in when this is not specified is called "object" mode.
countKeyPathForNode:
node
count key path for the given NSTreeNode.
insert:
sender
Insert an object created by newObject into arranged objects. This method will only function if the tree controller is in "object" mode.
insertChild:
sender
Inserts a child using the newObject method. This method will fail if canInsertChild returns `NO`. If the tree controller is in "object" mode, then newObject is called to add a new node.
insertObject:
object
atArrangedObjectIndexPath:
indexPath
Insert an object created by newObject into arranged objects. This method will only function if the tree controller is in "object" mode.
insertObjects:
objects
atArrangedObjectIndexPaths:
indexPaths
Inserts objects into arranged objects at the specified indexPaths. These arrays are expected to be parallel and have the same number of objects. This method will only function if the tree controller is in "object" mode.
leafKeyPath
Key value path for the flag which determins that this is a leaf. The path indicated here must be key-value compliant. This key path is optional as it can be determined by the children returned by the childrenKeyPath.
leafKeyPathForNode:
node
leaf key path for the given NSTreeNode.
moveNode:
node
toIndexPath:
indexPath
Moves node to given indexPath
moveNodes:
nodes
toIndexPath:
startingIndexPath
Move nodes to position at startingIndexPath
preservesSelection
If `YES`, then preserve the current selection when the content changes.
rearrangeObjects
Causes the controller to re-sort and rearrange the objects. This method should be called if anything has been done that affects the list of objects in the controller.
remove:
sender
Remove the currently selected object. This method will only function if the tree controller is in "object" mode.
removeObjectAtArrangedObjectIndexPath:
indexPath
Remove the currently selected object
removeObjectsAtArrangedObjectIndexPaths:
indexPaths
Removes objects at the specified indexPaths.
removeSelectionIndexPaths:
indexPaths
Removes selection of objects at the specified indexPaths.
selectedNodes
Array containing all selected nodes
selectedObjects
An NSArray containing all selected objects.
selectionIndexPath
The index path of the first selected object.
selectionIndexPaths
An array containing all of the currently selected objects.
selectsInsertedObjects
If `YES`, then when an object is inserted it is added to the selection.
setAlwaysUsesMultipleValuesMarker:
flag
Sets the flag to always use multiple values marker.
setAvoidsEmptySelection:
flag
Sets the flag to avoid empty selection.
setChildrenKeyPath:
path
Sets the children key path. This needs to be key-value compliant.
setCountKeyPath:
path
Sets the count key path. This needs to be key-value compliant. Setting this key path will disable add:, addChild:, remove:, removeChild:, and insert: methods. If this is not specified, the tree controller is in "object" mode.
setLeafKeyPath:
key
Sets leaf key path. This value needs to be key-value compliant.
setPreservesSelection:
flag
Sets the preserves selection flag.
setSelectionIndexPath:
indexPath
Makes indexPath the current selection.
setSelectionIndexPaths:
indexPaths
Makes the array indexPaths the current selections.
setSelectsInsertedObjects:
flag
Sets the flag that determines if objects inserted are automatically selected.
setSortDescriptors:
descriptors
Set the descriptors by which the content of this tree controller is sorted.
sortDescriptors
An array containing sort descriptors used to arrange content.