Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView section header iOS 5

I have multiples tables delegated to a UIViewController. In IOS4 I used the function: (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section to change the background of some table header section. In those that do not have sections, I return nil and all works fine.

In IOS5 if I return nil, the system puts one default header section. How do I hide the header section in the tables that I have only one section?

like image 836
flopes Avatar asked Aug 23 '11 17:08

flopes


1 Answers

Per the release notes, your UITableViewDelegate MUST now return 0.0 from tableView:heightForHeaderInSection:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.0;
}

Seems like a real pain. I don't know why they changed this, as everyone relies on the prior behavior - but they must have their reasons.

like image 63
Steve Avatar answered Nov 07 '22 14:11

Steve