NSTableRowView Class Reference

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

Overview

The NSTableRowView class is the view shown for a row in an NSTableView. It is responsible for displaying attributes associated with the row, including the selection highlight, and group row look.

Tasks

Display Style

Row Selection

Drag and Drop

Row Grouping

Overriding Row View Display Characteristics

Accessing A Row Column View

Properties

backgroundColor

The background color of the row.

@property(copy) NSColor *backgroundColor
Discussion

The property defaults to the table view’s backgroundColor, unless usesAlternatingRowBackgroundColors is set to YES. In that case, the colors alternate, and are automatically updated as required by insertions and deletions.

The value of the background color can be customized in the NSTableViewDelegate method tableView:didAddRowView:forRow:. The property is animatable.

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

draggingDestinationFeedbackStyle

Specifies the dragging destination feedback style.

@property NSTableViewDraggingDestinationFeedbackStyle draggingDestinationFeedbackStyle
Discussion

Possible values are defined in NSTableViewDraggingDestinationFeedbackStyle.

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

emphasized

Determines whether the row will draw with the alternate or secondary color (unless overridden).

@property(getter=isEmphasized) BOOL emphasized
Discussion

When emphasized is YES, the view will draw with the alternateSelectedControlColor defined by NSColor. When NO it will use the secondarySelectedControlColor defined by NSColor.

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

floating

Specifies whether the row is drawn using the floating style.

@property(getter=isFloating) BOOL floating
Discussion

Floating is a temporary attribute that is set when a particular group row is actually floating above other rows. The state may change dynamically based on the position of the group row. Drawing may be different for rows that are currently 'floating'.

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

groupRowStyle

Specifies whether this row view is a group row.

@property(getter=isGroupRowStyle) BOOL groupRowStyle
Discussion

When YES this row is a group row and will draw appropriately.

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

indentationForDropOperation

Defines the amount the drag target for a row should be indented.

@property CGFloat indentationForDropOperation
Discussion

The default is 0.

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

interiorBackgroundStyle

Specifies how the subviews should draw. (read-only)

@property(readonly) NSBackgroundStyle interiorBackgroundStyle
Discussion

This value is dynamically computed based on the set of properties set for the NSTableRowView.

Subclassers can override this value when they draw differently based on the currently displayed properties.

This property can also be set to determine the color a subview should use. See NSBackgroundStyle for supported values.

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

numberOfColumns

Returns the number of columns represented by views in the table row view. (read-only)

@property(readonly) NSInteger numberOfColumns
Discussion

The number of columns may not be equal to the number of columns in the enclosing NSTableView, if this row view is a group style and has a single view that spans the entire width of the row.

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

selected

Determines whether the row is selected.

@property(getter=isSelected) BOOL selected
Discussion

YES if selected, otherwise NO.

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

selectionHighlightStyle

Specifies the selection highlight style.

@property NSTableViewSelectionHighlightStyle selectionHighlightStyle
Discussion

The possible values are specified in NSTableViewSelectionHighlightStyle in NSTableView Class Reference.

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

targetForDropOperation

Specifies whether this row will draw a drop indicator based on the current dragging feedback style.

@property(getter=isTargetForDropOperation) BOOL targetForDropOperation
Discussion

When YES, the row view will draw a drop on indicator based on the current draggingDestinationFeedbackStyle.

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

Instance Methods

drawBackgroundInRect:

Draws the background of the row in the rectangle.

- (void)drawBackgroundInRect:(NSRect)dirtyRect
Parameters
dirtyRect

The rectangle that requires drawing.

Discussion

Overriding this method allows an application to draw a custom background for a table row view.

By default, this method draws the background color or group row style as appropriate for the row. This method also draws the “below look” for a drop target if targetForDropOperation is YES.

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

drawDraggingDestinationFeedbackInRect:

Draws the row’s dragging destination feedback when the entire row is a drop target.

- (void)drawDraggingDestinationFeedbackInRect:(NSRect)dirtyRect
Parameters
dirtyRect

The rectangle that requires drawing.

Discussion

Overriding this method allows an application to draw custom dragging destination feedback when the entire row is a drop target.

This method only is called if targetForDropOperation is YES, and is only drawn based on the properties set, such as the group row style.

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

drawSelectionInRect:

Draws the selected row.

- (void)drawSelectionInRect:(NSRect)dirtyRect
Parameters
dirtyRect

The rectangle that requires drawing.

Discussion

This method is only called if the selection should be drawn.

The selection will automatically be alpha-blended if the selection is animating in or out.

The default selection drawn is dependent on the selectionHighlightStyle.

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

drawSeparatorInRect:

Draws the horizontal separator between table rows.

- (void)drawSeparatorInRect:(NSRect)dirtyRect
Parameters
dirtyRect

The rectangle that requires drawing.

Discussion

By default, the separator is only drawn if the enclosing table's gridStyleMask is set to include a horizontal separator.

The separator should be drawn at the bottom of the row view, indicating a separation from this row and the next.

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

viewAtColumn:

Provides access to the given view at a particular column.

- (id)viewAtColumn:(NSInteger)column
Parameters
column

The index of the column.

Return Value

The view for the specified column.

Discussion

This is the only way to access cell views after the row view has been removed from the table.

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