I have a table with custom header views that no matter when, or what value I choose for section, I always get nil value. I have another table with the same problem.
In swift
All you need is to create an instance of UITableViewHeaderFooterView
for the header view you need to return
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let sectionHeaderView = UITableViewHeaderFooterView()
//customize your view here
return sectionHeaderView
}