Recall & Review
beginner
What is the purpose of section headers in a UITableView?
Section headers help group related rows visually and provide a title or description for each group, making the list easier to understand.
Click to reveal answer
intermediate
Which UITableViewDelegate method provides a view for a section header?
tableView(_:viewForHeaderInSection:) returns a UIView to display as the header for a given section.
Click to reveal answer
intermediate
How do you set the height of a section footer in a UITableView?
Implement tableView(_:heightForFooterInSection:) in UITableViewDelegate and return the desired height in points.
Click to reveal answer
beginner
True or False: Section footers can only display text, not custom views.
False. Section footers can display custom views by implementing tableView(_:viewForFooterInSection:).
Click to reveal answer
intermediate
What happens if you return nil from tableView(_:viewForHeaderInSection:)?
The table view will display the default header, which can be a simple text label if you provide a title via tableView(_:titleForHeaderInSection:).
Click to reveal answer
Which method sets the text title for a section header in UITableView?
✗ Incorrect
The method tableView(_:titleForHeaderInSection:) returns a simple text string to display as the section header title.
How can you provide a custom view for a section footer?
✗ Incorrect
To show a custom view for a footer, implement tableView(_:viewForFooterInSection:) and return your UIView.
What delegate method controls the height of a section header?
✗ Incorrect
tableView(_:heightForHeaderInSection:) lets you specify the height in points for the header of a section.
If you want no header for a section, what should you return from tableView(_:heightForHeaderInSection:)?
✗ Incorrect
Returning 0 from tableView(_:heightForHeaderInSection:) hides the header for that section.
Which of these is NOT a valid way to customize section headers?
✗ Incorrect
cellForRowAt is for rows, not headers or footers.
Explain how to add a custom view as a section header in a UITableView.
Think about which delegate method returns a UIView for the header.
You got /3 concepts.
Describe the difference between providing a title and a custom view for section footers.
One is simple text, the other is a full view.
You got /3 concepts.