NSTableCellView Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.7 and later.
Declared in
NSTableCellView.h
Companion guides
Related sample code

Overview

The NSTableCellView class is a reusable container view shown for a particular cell in an NSTableView instance that uses rows for content. The imageView and textField properties are connected in Interface Builder. Additional properties can be added by subclassing NSTableCellView and adding the required properties and connecting them programmatically or in Interface Builder.

The objectValue is used when setting the value of the view cell by the tableView:objectValueForTableColumn:row: method in the NSTableViewDataSource. If you use your own custom view cells that are not based on NSTableCellView you should implement this property in order to be able to receive changes to cell values.

Tasks

Represented Object

Displayed Items

Getting and Setting the Background Style

Getting and Setting the Row Size Style

Dragging Images

Properties

backgroundStyle

This property is automatically set by the enclosing row view to let this view know what its background looks like.

@property NSBackgroundStyle backgroundStyle
Discussion

The property is automatically set by the enclosing NSTableRowView to let this view know what its background looks like. For instance, when the backgroundStyle is NSBackgroundStyleDark, the view should use a light text color.

The default implementation automatically forwards calls to all subviews that implement setBackgroundStyle: or are an NSControl, which have NSCell classes that respond to setBackgroundStyle:.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSTableCellView.h

draggingImageComponents

Returns dragging images for the cell. (read-only)

@property(retain, readonly) NSArray *draggingImageComponents
Discussion

The default implementation of this method returns an array of up to two NSDraggingImageComponent instances -- one for the imageView and another for the textField (unless the property is nil).

These method can be subclassed and overridden to provide a custom set of NSDraggingImageComponent objects to create the drag image from this view.

Availability
  • Available in OS X v10.7 and later.
Related Sample Code
Declared In
NSTableCellView.h

imageView

Image displayed by the cell.

@property(assign) NSImageView *imageView
Discussion

This property is typically configured when the row is created in the NSTableViewDataSource protocol method tableView:viewForTableColumn:row:.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSTableCellView.h

objectValue

The object that represents the cell data.

@property(retain) id objectValue
Discussion

The objectValue is automatically set by the table when using bindings or is the object returned by the NSTableViewDataSource protocol method tableView:objectValueForTableColumn:row:.

Availability
  • Available in OS X v10.7 and later.
See Also
Declared In
NSTableCellView.h

rowSizeStyle

Returns the row size style.

@property NSTableViewRowSizeStyle rowSizeStyle
Discussion

The rowSizeStyle property is set by the NSTableView to its effectiveRowSizeStyle. The cell view will layout the textField and imageView based on the rowSizeStyle.

A value of NSTableViewRowSizeStyleDefault should never be set on the cell view, as it is an appropriate value only for the table as it returns the effective row size style for the table.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSTableCellView.h

textField

Text displayed by the cell.

@property(assign) NSTextField *textField
Discussion

This property is typically configured when the row is created in the NSTableViewDelegate Protocol protocol method tableView:viewForTableColumn:row:.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSTableCellView.h