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 th
I realize this was answered a long time ago, but for anyone else running into a similar situation, I'll share what ended up working for me:
If you're using a xib, select the top level view and set 'Status Bar' to 'None' in the Simulated Metrics area of the Attributes Inspector. Fixed my spacing issue right up.
There was a space above the UITableView itself, and also between the cells. Found my solution in 2 different answers above..posting it again so that nobody misses both solutions.
This removed the space from above :
self.automaticallyAdjustsScrollViewInsets = NO;
and this removed the spaces below the cells : Setting the 'Style' attribute of the UITableView to 'Plain'
I was seeing this extra space at the top of one of my table views in a very strange situation.
After I added a UIScrollView
as the root view of my first controller in my navigation stack, if I presented the next controller as a Show Detail
segue, my next controller would have the space above its table view.
The solution for me was to change the segue to Present Modally
and everything went back to normal.
The strangest part of the segue changing was that before I added my root view being a UIScrollView
, my Show Detail
segue was presenting the next controller modally. Yet after I added the root UIScrollView
, the Show Detail
segue was pushing on the next controller (which was not what I wanted).
Had a similar problem, even setting automaticallyAdjustsScrollViewInsets to NO. This solved for me:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
{
return CGFLOAT_MIN;
}
In the UIViewController.h
iOS9 SDK have a method:
@property(nonatomic,assign) BOOL automaticallyAdjustsScrollViewInsets NS_AVAILABLE_IOS(7_0); // Defaults to YES
is not a property, so
self.automaticallyAdjustsScrollViewInsets = NO;
should be
-(BOOL)automaticallyAdjustsScrollViewInsets{
return NO;
}
Just add this in you ViewDidLoad
method
self.automaticallyAdjustsScrollViewInsets = NO;