iOS 15 - UItableView top padding issue

Viewed 3142

I updated my iPhone to iOS 15 and Xcode to 13 version and now my app have a weird padding on top in all screens that has a tableView. enter image description here

How can I solve this problem?

3 Answers

If you want to remove this top padding in all views, you can call this code in AppDelegate:

if #available(iOS 15.0, *) {
    UITableView.appearance().sectionHeaderTopPadding = .zero
}

The below code is fixed my issue

 if #available(iOS 15, *) {
        UITableView.appearance().tableHeaderView = .init(frame: .init(x: 0, y: 0, width: 0, height: CGFloat.leastNonzeroMagnitude))
    }
Related