Instance Method

rowViewAtRow:makeIfNecessary:

Returns a row view at the specified index, creating one if necessary.

Declaration

- (__kindof NSTableRowView *)rowViewAtRow:(NSInteger)row makeIfNecessary:(BOOL)makeIfNecessary;

Parameters

row

The row index.

makeIfNecessary

YES if a view is required, NO if you want to update properties on a view, if one is available.

Return Value

An instance, or subclass, of NSTableRowView. Returning nil is also valid if makeIfNecessary is NO and the view did not exist.

Discussion

This method first attempts to return a currently displayed view in the visible area. If there is no visible view, and makeIfNecessary is YES, a prepared temporary view is returned. If makeIfNecessary is NO, and the view is not visible, nil is returned.

In general, makeIfNecessary should be YES if you require a resulting view, and NO if you want to update properties on a view only if it is available (generally this means it is visible).

An exception is thrown if row falls outside of the number of rows in the table (numberOfRows). The returned result should generally not be held onto for longer than the current run loop cycle. It’s better to call rowViewAtRow:makeIfNecessary: whenever a view is required.

See Also

Creating Views to Display

- makeViewWithIdentifier:owner:

Returns a new or existing view with the specified identifier.

- viewAtColumn:row:makeIfNecessary:

Returns a view at the specified row and column indexes, creating one if necessary.