iosuitableviewios11ios10.3

iOS 11 UiTableViewCell Location issue


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


Solution

  • 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
    }