Instance Property

separatorInset

Specifies the default inset of cell separators.

Declaration

var separatorInset: UIEdgeInsets { get set }

Discussion

In iOS 7 and later, cell separators do not extend all the way to the edge of the table view. This property sets the default inset for all cells in the table, much as rowHeight sets the default height for cells. It is also used for managing the “extra” separators drawn at the bottom of plain style tables.

For example, to specify a table view where the default left separator inset is 3 points and the default right separator inset is 11, you would write:

tableView.separatorInset = UIEdgeInsetsMake(0, 3, 0, 11);

If every cell in a table contains an image view of the same size, by default iOS vertically aligns the leading edge of all separators. In a table that mixes text-only cells with cells that contain image views, you can use the separatorInset property to ensure that the separators are vertically aligned.

In a right-to-left user interface, an inset that you set using the separatorInset property automatically flips its left and right measurements.

Special Considerations

Only left and right insets are honored. In a right-to-left user interface, the inset measurements are automatically flipped.

See Also

Configuring a Table View

var style: UITableViewStyle

Returns the style of the table view.

func numberOfRows(inSection: Int)

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

var numberOfSections: Int

The number of sections in the table view.

var rowHeight: CGFloat

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

var separatorStyle: UITableViewCellSeparatorStyle

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 separatorInsetReference: UITableViewSeparatorInsetReference

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

enum UITableViewSeparatorInsetReference

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.