tableView(_:viewForHeaderInSection:)
Asks the delegate for a view to display in the header of the specified section of the table view.
Declaration
optional func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?Parameters
- tableView:
The table view asking for the view.
- section:
The index number of the section containing the header view.
Mentioned in
Return Value
A UILabel, UIImageView, or custom view to display at the top of the specified section.
Discussion
If you implement this method but don’t implement tableView(_:heightForHeaderInSection:), the table view calculates the height automatically, or uses the value of sectionHeaderHeight if set.