Starting in iOS7, there is additional space at the top of my UITableView
's which have a style UITableViewStyleGrouped
.
Here is an example:
The tableview starts at the first arrow, there is 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
?
Thanks to the answer by @Aurelien Porte. Here is my solution
Cause of this issue:-
In ViewDidLoad:-
No Need For Something Like This :-
In
heightForHeaderInSection
delegate:-In
viewForHeaderInSection
delegate :-Storyboard:
Just uncheck:
Adjust Scroll View Insets
in View Controller's optionsCode:
This is the solution for iOS 10 using Swift 3:
You can get rid of top and bottom paddings by implementing the following methods from the
UITableViewDelegate
.That's all folks!
So I was trying every method here, and this time none of them helped. My case was a grouped table view on iOS 9. I don't really know why and how I found out this one, but for me, setting the
tableViewHeader
with aUIView
with at least0.01
height worked out.CGRectZero
didn't help, nothing really helped:To be specific, to remove tableviewHeader space from top i made these changes:
YouStoryboard.storyboard > YouViewController > Select TableView > Size inspector > Content insets - Set it to never.