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
?
In my case this was what helped me. I'm supporting ios6 also.
We have multiple answers for this.
1) You can add UIImageview at view didload
2) You can set header and footer height 0.1
3) You can add header and footer view with height 0.1
I was helped by the following:
YouStoryboard.storyboard > YouViewController > Attributes inspector > Uncheck - Adjust scroll view insets.
According to this transition guide for iOS7 by Apple, the scroll view’s content insets is automatically adjusted. The default value of automaticallyAdjustsScrollViewInsets is set to YES.
The UIViewController which has the UITableView should set this property to NO.
This will do the trick.
EDIT 1:
Also, one could try -
This also removes the extra padding on the top.
use this one i think this help...
You could detect if your app is running iOS7 or greater and add this two methods in your table view delegate (usually in your UIViewController code)
This maybe is not an elegant solution but works for me
Swift version: