why extra space is at top of UITableView - simple

Yes, that other question is very much related. UITableViewStyleGrouped divides each section into a "group" by inserting that extra padding…similar to what it did pre-iOS7, but clear instead of colored by default, and just at the top instead of all the way around. If you don't want the padding by default, use UITableViewStylePlain.

Otherwise, if you need to keep the style the same, do what this other posted from that link recommended and change the content inset:

self.tableView.contentInset = UIEdgeInsetsMake(-36, 0, 0, 0);

Or do what this poster suggested and set the tableHeaderView's height to .-1, i.e. nearly 0:

self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, 0.01f)];

Everybody keeps talking about this self.automaticallyAdjustsScrollViewInsets option.
However this did not work for me at all. What did work for me, was setting the "Content Insets" property to Never.

screenshot demonstrating where to find the setting

Such an annoying problem.


Go to the attributes inspector of the View Controller by selecting the xib or the controller in Storyboard. Uncheck the Adjust Scroll View Insets in Layout. It will solve the problementer image description here

Tags:

Ios