Starting in iOS7, there is additional space at the top of my UITableView
\'s which have a style UITableViewStyleGrouped
.
Here is an example:<
I played around with it a bit more and it seems like this is a side-effect of setting the tableView's tableHeaderView = nil
.
Because my tableView has a dynamically appearing tableHeaderView
, when I need to hide the tableHeaderView
, instead of doing self.tableView.tableHeaderView = nil;
, I do:
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, 0.01f)];
I like this solution better than setting a somewhat arbitrary contentInset.top
because I use the contentInset.top
dynamically as well. Having to remember to remove an extra 35px whenever I recalculate contentInset.top
is tedious.