iOS 7 UITableView: How to remove space between navigation bar and first cell

Description of the problem: with iOS 7 in grouped UITableView there is a gap between the top of the table view and the first cell.

The strange part is that when I load the content for the first time the table appears to be ok (first image), but when I scroll down a space appears between top and first cell (second image):

enter image description hereenter image description here

With style plain this behavior does't occur but unfortunately I need to use the grouped table view style.

Any ideas about?


Just add this in you ViewDidLoad method

self.automaticallyAdjustsScrollViewInsets = NO;

The answer was very funny for me and my team, and worked like a charm

  • In the Interface Builder, Just move the tableview under another view in the view hierarchy.

REASON:

We observed that this happens only for the First View in the View Hierarchy, if this first view is a UITableView. So, all other similar UITableViews do not have this annoying section, except the first. We Tried moving the UITableView out of the first place in the view hierarchy, and everything was working as expected.


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