Home

viewbased

Viewbased is a term used in GUI framework design to describe a style of user interface where items in lists, tables, or collections are rendered as individual views rather than as simple, cell-rendering objects. In Apple's Cocoa framework, view-based refers specifically to NSTableView, NSOutlineView, and NSCollectionView that display content using NSView-based cells instead of the older NSCell-based approach.

Historically, macOS provided cell-based table and outline views that drew content with NSCell subclasses such as

Implementation in a view-based context typically involves providing a view for a given row and column through

Benefits of the view-based approach include greater flexibility for complex layouts, easier incorporation of interactive controls

Outside of Cocoa, the term viewbased is sometimes used more generally to contrast architectures that render

NSTextFieldCell
and
NSImageCell.
With
macOS
Lion
(OS
X
10.7),
Apple
introduced
view-based
table
and
outline
views,
allowing
each
row
or
item
to
be
represented
by
a
distinct
NSView.
This
shift
enabled
richer
layouts
and
controls
within
each
cell
and
simplified
customization.
a
data
source
method
such
as
tableView:viewForTableColumn:row:.
Views
are
reused
via
a
mechanism
similar
to
cell
reuse,
for
example
by
requesting
a
view
with
a
particular
identifier.
Commonly,
developers
use
subclasses
of
NSTableCellView
to
expose
outlets
(such
as
text
fields
and
image
views)
for
easy
configuration.
within
cells,
and
more
straightforward
customization.
It
also
supports
performance
optimizations
through
view
reuse.
Drawbacks
can
include
higher
memory
usage
for
large
numbers
of
visible
cells
and
the
need
to
migrate
existing
cell-based
code.
data
with
dedicated
views
against
those
relying
on
simple,
non-view
renderers.