Home

NSOutlineView

NSOutlineView is a Cocoa AppKit control for displaying hierarchical data in macOS applications. It is a subclass of NSTableView and presents items in a grouped, expandable list. Each item can have children, which can be shown or hidden by expanding or collapsing the item. NSOutlineView is data-driven and relies on the NSOutlineViewDataSource protocol to obtain the structure of the data and on the NSOutlineViewDelegate protocol to respond to user actions and customize presentation.

Key data source methods provide the tree structure: number of children of a given item, the child

NSOutlineView supports common table features such as multiple selection, editing, reordering by drag and drop, and

Developers typically implement a custom data model for the tree, implement the required data source methods,

item
for
a
given
index,
and
whether
an
item
is
expandable.
The
root
item
is
typically
nil.
Delegate
methods
are
used
for
handling
events
such
as
selection
changes,
item
expansion
and
collapse,
and
for
supplying
the
views
used
to
render
each
item
in
a
given
column.
In
modern
AppKit,
outline
views
are
view-based,
with
per-item
views
created
by
outlineView:viewForTableColumn:item:
or
row
view
via
outlineView:rowViewForItem:.
context
menus.
It
can
display
different
cell
views
per
column
and
per
item,
and
can
integrate
with
a
data
model
that
represents
a
tree
structure.
It
is
commonly
used
for
navigational
interfaces,
project
outlines,
and
file
systems,
and
is
the
standard
way
to
present
hierarchical
data
in
macOS
applications
that
use
AppKit.
and
provide
appropriate
views
for
display
via
the
delegate.
Accessibility
support
and
configuration
options
allow
fine-grained
control
over
appearance
and
behavior.