Group Group Group Group Group Group Group Group Group

Chapter 36: Table View Section Header Color

I’m working on the “Back to Black” section in chapter 36. I made all of the suggested changes to the table view, but I’m not able to get the section headers in the Locations table view to match the image shown in the book. Here’s the image from the book:

image

Here’s what mine looks like:

The section headers in the image from the book look like they have a grayish color, but mine are white. Any thoughts on how to change this to resemble what’s shown in the book?

@clarkesm Do you still have issues with this?

@shogunkaramazov @clarkesm I think I found a solution for this - the book is either referencing the wrong setting, or omitting a bunch of code entirely. It appears you can’t change the background colours of section headers in the Storyboard, you have to do it in code. The easiest solution I could find is to overwrite the tableView(:willDisplayHeaderView:) method, and set the tint colour there. Here’s an example:

override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
view.tintColor = UIColor.gray
}