I have a grouped UITableView where not all sections may be displayed at once, the table is driven by some data that not every record may have. My trouble is that the record
The key is to set the table view's sectionHeaderHeight and sectionFooterHeight to zero.
You can do this either in viewDidLoad, or in the User Defined Runtime Attributes section in your storyboard/xib. For some reason, in the Size Inspector tab, you cannot set the header or footer height below 1.
I found that once I did this, I didn't need to override any other delegate methods in a special way. I simply return 0 from numberOfRowsInSection and nil from titleForHeaderInSection for sections that are empty, and they take up no space in my table view.
Sections that do have titles are automatically given the proper header size, and the top of the table view still has the default blank space.