dequeueReusableHeaderFooterView(withIdentifier:)
Returns a reusable header or footer view after locating it by its identifier.
Declaration
func dequeueReusableHeaderFooterView(withIdentifier identifier: String) -> UITableViewHeaderFooterView?Parameters
- identifier:
A string identifying the header or footer view to be reused. This parameter must not be
nil.
Mentioned in
Return Value
A UITableViewHeaderFooterView object with the associated identifier or nil if no such object exists in the reusable view queue.
Discussion
For performance reasons, a table view’s delegate should generally reuse UITableViewHeaderFooterView objects when it’s asked to provide them. A table view maintains a queue or list of UITableViewHeaderFooterView objects that the table view’s delegate has marked for reuse. It marks a view for reuse by assigning it a reuse identifier when it creates it (in the init(reuseIdentifier:) method of UITableViewHeaderFooterView).
You can use this method to access specific template header and footer views that you previously created. You can access a view’s reuse identifier through its reuseIdentifier property.