Initializer

init(frame:style:)

Initializes and returns a table view object having the given frame and style.

Declaration

init(frame: CGRect, style: UITableView.Style)

Parameters

frame

A rectangle specifying the initial location and size of the table view in its superview’€™s coordinates. The frame of the table view changes as table cells are added and deleted.

style

A constant that specifies the style of the table view. For a list of valid styles, see UITableView.Style.

Return Value

Returns an initialized UITableView object.

Discussion

You must specify the style of a table view when you create it, and you cannot change that style later. If you initialize the table view with the UIView method init(frame:), the UITableView.Style.plain style is used as a default.

See Also

Creating a Table View