Instance Method

tableView(_:heightOfRow:)

Asks the delegate for the height of the specified row.

Declaration

optional func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat

Parameters

tableView

The table view that sent the message.

row

The row index.

Return Value

The height of the row. The height should not include intercell spacing and must be greater than zero.

Discussion

You should implement this method if your table supports varying row heights.

Although table views may cache the returned values, you should ensure that this method is efficient. When you change a row's height you must invalidate the existing row height by calling noteHeightOfRows(withIndexesChanged:). NSTableView automatically invalidates its entire row height cache when reloadData() and noteNumberOfRowsChanged() are called.

If you call view(atColumn:row:makeIfNecessary:) or rowView(atRow:makeIfNecessary:) within your implementation of this method, an exception is thrown.

See Also

Setting Row and Column Size

func tableView(NSTableView, sizeToFitWidthOfColumn: Int) -> CGFloat

Asks the delegate to provide custom sizing behavior when a column’s resize divider is double clicked.