3

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.

Attached the image of both screenshots from iOS 10.3 and iOS 11

Vinodh
  • 5,262
  • 4
  • 38
  • 68
Mugunth Chandran
  • 261
  • 2
  • 14

2 Answers2

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