sectionHeaderTopPadding need to use below iOS 15

496 Views Asked by At

i want to set sectionHeaderTopPadding below iOS 15, but this property works only in ios 15. How can i set section header padding to zero below iOS 15

1

There are 1 best solutions below

0
SwiftCoderVaibhav On

i have faced a gap issue that appear between table header view & nav bar. So to fix that, just add a tableHeaderView on viewDidLoad. And remember to make sure the header with a non zero height. please try the below mentioned solution might be helpful for you:

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