I have a UITableView where in some instances, certain sections have zero rows. My goal is that when this is true, I don\'t want any wasted space in the table view, it should
It works for me:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
tableView.sectionHeaderHeight = (section == 0 ? 10 : 0);
return tableView.sectionHeaderHeight;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
tableView.sectionFooterHeight = (section == 0 ? 20 : 4);
return tableView.sectionFooterHeight;
}