Home

NSCell

NSCell is a class in Apple's AppKit that represents the content and behavior of a single element in a cell-based user interface. It is the primitive building block used by controls that arrange multiple items in a grid or list, such as matrix-like controls and form elements. NSCell is an abstract or base class; concrete appearance and interaction are provided by its descendants such as NSTextFieldCell, NSImageCell, and NSButtonCell.

An NSCell is responsible for drawing its content, managing basic interaction, and optionally supporting in-place editing.

Subclasses implement specific drawing and editing behavior; for example, NSTextFieldCell draws and edits text, NSImageCell displays

NSCell originated in NeXTSTEP and remains part of AppKit for backward compatibility with older code. In modern

Developers configure NSCell instances and assign them to controls that support cell-based content; a single cell

It
can
hold
a
text
string
and/or
an
image,
and
can
store
an
associated
representedObject
to
link
to
model
data.
Cells
also
maintain
state
information
such
as
highlighted
or
enabled,
and
in
controls
that
support
actions,
a
cell
can
target
and
trigger
an
action
when
activated.
an
image,
and
NSButtonCell
handles
button-like
interactions
and
can
invoke
a
target-action
pair.
Because
many
controls
in
AppKit
expose
a
cell
property,
NSCell
provides
a
common
interface
for
drawing
and
state
management
while
the
actual
behavior
is
defined
by
the
concrete
cell
type.
Cocoa
development,
view-based
controls
have
become
the
norm,
but
cell-based
constructs
and
NSCell
classes
are
still
available
in
the
API
for
legacy
code
and
certain
controls.
can
be
reused
to
render
many
items
in
a
grid
or
list.