Instance Property

rowHeight

The height of each row (that is, table cell) in the table view.

Declaration

var rowHeight: CGFloat { get set }

Discussion

Row height is expressed in points. You may set the row height for cells if the delegate doesn’t implement the tableView(_:heightForRowAt:) method. The default value of rowHeight is automaticDimension. Note that if you create a self-sizing cell in Interface Builder, the default row height is changed to the value set in Interface Builder. To get the expected self-sizing behavior for a cell that you create in Interface Builder, you must explicitly set rowHeight equal to automaticDimension in your code.

There are performance implications to using tableView(_:heightForRowAt:) instead of rowHeight. Every time a table view is displayed, it calls tableView(_:heightForRowAt:) on the delegate for each of its rows, which can result in a significant performance problem with table views having a large number of rows (approximately 1000 or more).

See Also

Configuring a Table View

var style: UITableView.Style

Returns the style of the table view.

func numberOfRows(inSection: Int) -> Int

Returns the number of rows (table cells) in a specified section.

var numberOfSections: Int

The number of sections in the table view.

var separatorStyle: UITableViewCell.SeparatorStyle

The style for table cells used as separators.

var separatorColor: UIColor?

The color of separator rows in the table view.

var separatorEffect: UIVisualEffect?

The effect applied to table separators.

var backgroundView: UIView?

The background view of the table view.

var separatorInset: UIEdgeInsets

Specifies the default inset of cell separators.

var separatorInsetReference: UITableView.SeparatorInsetReference

An indicator of how the separator inset value should be interpreted.

enum UITableView.SeparatorInsetReference

Constants indicating how to interpret the separator inset value of a table view.

var cellLayoutMarginsFollowReadableWidth: Bool

A Boolean value that indicates whether the cell margins are derived from the width of the readable content guide.