Instance Method

tableView(_:willDisplay:forRowAt:)

Tells the delegate the table view is about to draw a cell for a particular row.

Declaration

optional func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)

Parameters

tableView

The table-view object informing the delegate of this impending event.

cell

A table-view cell object that tableView is going to use when drawing the row.

indexPath

An index path locating the row in tableView.

Discussion

A table view sends this message to its delegate just before it uses cell to draw a row, thereby permitting the delegate to customize the cell object before it is displayed. This method gives the delegate a chance to override state-based properties set earlier by the table view, such as selection and background color. After the delegate returns, the table view sets only the alpha and frame properties, and then only when animating rows as they slide in or out.

See Also

Configuring Rows for the Table View

func tableView(UITableView, indentationLevelForRowAt: IndexPath) -> Int

Asks the delegate to return the level of indentation for a row in a given section.

func tableView(UITableView, shouldSpringLoadRowAt: IndexPath, with: UISpringLoadedInteractionContext) -> Bool

Called to let you fine tune the spring-loading behavior of the rows in a table.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software