Starting in iOS7, there is additional space at the top of my UITableView
\'s which have a style UITableViewStyleGrouped
.
Here is an example:<
I had the same fix as arielyz. Once I moved the UITableView to be not the first subview of the parent view, it went away. My space was 20 px, not 35.
I wasn't able to recreate it in a portrait xib, only a landscape xib. I'll file a radar bug later if I can reproduce it in a simple demo app.
I was helped by the following:
YouStoryboard.storyboard > YouViewController > Attributes inspector > Uncheck - Adjust scroll view insets.
While using grouped TableView use this to avoid border cutting in viewWillAppear
self.tableView.contentInset = UIEdgeInsetsMake(-35, 0, 0, 0);
Thanks to the answer by @Aurelien Porte. Here is my solution
Cause of this issue:-
In ViewDidLoad:-
self.edgesForExtendedLayout = UIRectEdge.None
self.automaticallyAdjustsScrollViewInsets = false
No Need For Something Like This :-
self.myTableview.contentInset = UIEdgeInsetsMake(-56, 0, 0, 0)
In heightForHeaderInSection
delegate:-
if section == 0
{
return 1
}
else
{
return 40; // your other headers height value
}
In viewForHeaderInSection
delegate :-
if section == 0
{
// Note CGFloat.min for swift
// For Objective-c CGFLOAT_MIN
let headerView = UIView.init(frame: CGRectMake(0.0, 0.0, self.myShaadiTableview.bounds.size.width, CGFloat.min))
return headerView
}
else
{
// Construct your other headers here
}
use this one i think this help...
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 0.005f;// set this according to that you want...
}
For IOS 7 if you are allocing a tableview in a view controller you may look into
self.edgesForExtendedLayout = UIRectEdgeNone;
your problem seemed similar to mine
Update:
Swift in iOS 9.x:
self.edgesForExtendedLayout = UIRectEdge.None
Swift 3 :
self.edgesForExtendedLayout = UIRectEdge.init(rawValue: 0)