I am trying to have headers in my grouped tableView but not footers. I am creating headers with:
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "Header") as! DateHeaderTableViewHeaderFooterView
...
return headerView
}
I have setup the tableView in storyboard to use automatic dimensions for all cells and headers and footers.
I assumed because I didn't provide any footers, they would not exist however footers are being added to each section. Also all the headers and footers have a gray background.
I tried unchecking the footer automatic dimension and selecting a value however the lowest value it can accept is 1 and still the footer shows up.
How can I have headers but not footers and change the background color of the header?
I can achieve what I want using a plain tableView however the headers are pinned to the top which I am trying to avoid.
You need to implement the following method:
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return CGFloat.leastNormalMagnitude
}