Instance Method

prepareForReuse()

Prepares a reusable cell for reuse by the table view'€™s delegate.

Declaration

func prepareForReuse()

Discussion

If a UITableViewCell object is reusable—that is, it has a reuse identifier—this method is invoked just before the object is returned from the UITableView method dequeueReusableCell(withIdentifier:). For performance reasons, you should only reset attributes of the cell that are not related to content, for example, alpha, editing, and selection state. The table view'€™s delegate in tableView(_:cellForRowAt:) should always reset all content when reusing a cell. If the cell object does not have an associated reuse identifier, this method is not called. If you override this method, you must be sure to invoke the superclass implementation.

See Also

Reusing Cells

var reuseIdentifier: String?

A string used to identify a cell that is reusable.