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
This is a bit tricky, as 0.0f value is not accepted. but anything close enough to zero will do the trick. If You decide not to be pixel perfect and want the round numbers, then 1.0f will do almost the same, as 1px difference in height will be fairly noticable.
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if(section == 1 )
return 0.000001f;
else return 44.0f; // put 22 in case of plain one..
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 0.000001f; //removing section footers
}