Grouped UITableView 35 point / pixel top inset / padding

ios, objective-c, uitableview

Solution

It seems that this:

[self setTableHeaderView:[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, width, FLT_MIN)]];

In init, where `self` is a `UITableView`, will get rid of the top 35 points.

Problem

Please note, I'm going to refer to points as pixels in this question. I have a grouped `UITableView` with 3 sections, each with a 40 pixel tall header view. The first header in the table view seems to be given a y position of 35 pixels by the system. I've tried messing around with `automaticallyAdjustsScrollViewInsets` and a few other iOS 7 automatic pieces, but to no avail. Why is my `UITableView` content being inset by 35 pixels? EDIT: I've seen this answer and many other threads on this. I have valid headers and header heights. Also, setting the default to `FLT_MIN`, 0.01f, 1.0f or 100.0f doesn't fix the problem. Here is my header implementation: ``` - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { UIView *header = (self.headerViews.count > section ? self.headerViews[section] : nil); return (header.viewHeight ? : FLT_MIN); } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *header = (self.headerViews.count > section ? self.headerViews[section] : nil); return (header.viewHeight ? header : nil); } ``` I'm also setting: ``` - (BOOL)automaticallyAdjustsScrollViewInsets{return NO;} ``` and ``` [self setSectionHeaderHeight:FLT_MIN]; ```

Original source

Related problems