I have a four UITableView cell one after another. On iOS 10.3 the first cell is right after the status bar but in iOS 11 there is some space between the status bar and the first cell.
Asked
Active
Viewed 1,448 times
3
-
is there an iOS 11 stable version? On my opinion, such questions should be for stable iOS. Because it is still in beta and some thing could change before release. – Aleksey Potapov Aug 16 '17 at 18:34
-
This is an issue till iOS 11 beta 5 – Mugunth Chandran Aug 16 '17 at 20:12
2 Answers
4
I had the similar issue in iOS 11. The empty spaces was header and footer. In iOS < 11 it was enough to set heightForHeaderInSection
and heightForFooterInSection
to CGFLOAT_MIN
. In iOS 11 I had also to return nil in viewForHeaderInSection
and viewForFooterInSection
.
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection: (NSInteger)section {
return CGFLOAT_MIN;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return CGFLOAT_MIN;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return nil;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
return nil;
}

Julia K.
- 113
- 1
- 6
3
It might be due to newly introduced contentInsetAdjustmentBehavior
By default is set to .automatic
but it can be disabled switching it to .never
:
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.never
}

GuillermoMP
- 1,694
- 16
- 19