UITableView : viewForHeaderInSection: not called during reloadData:

inforeqd picture inforeqd · Feb 26, 2013 · Viewed 59.1k times · Source

I've set up the tableview with correct delegate and datasource linkages.. the reloadData method calls the datasource and the delegate methods except for viewForHeaderInSection:.

Why is that so?

Answer

rmaddy picture rmaddy · Feb 26, 2013

The use of tableView:viewForHeaderInSection: requires that you also implement tableView:heightForHeaderInSection:. This should return an appropriate non-zero height for the header. Also make sure you do not also implement the tableView:titleForHeaderInSection:. You should only use one or the other (viewForHeader or titleForHeader).