Why is there extra padding at the top of my UITableView with style UITableViewStyleGrouped in iOS7

esilver picture esilver · Sep 18, 2013 · Viewed 260.6k times · Source

Starting in iOS7, there is additional space at the top of my UITableView's which have a style UITableViewStyleGrouped.

Here is an example:

enter image description here

The tableview starts at the first arrow, there are 35 pixels of unexplained padding, then the green header is a UIView returned by viewForHeaderInSection (where the section is 0).

Can anyone explain where this 35-pixel amount is coming from and how I can get rid of it without switching to UITableViewStylePlain?


Update (Answer):

In iOS 11 and later:

tableView.contentInsetAdjustmentBehavior = .never

Answer

Alexander picture Alexander · Oct 1, 2013

I was helped by the following:

YouStoryboard.storyboard > YouViewController > Attributes inspector > Uncheck - Adjust scroll view insets.

enter image description here