Contents

init(frame:style:)

Creates and returns a table view with the specified 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 Style Swift.enum.

Return Value

Returns an initialized UITableView object.

Discussion

You must specify the style of a table view when you create it, and you can’t 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