Search code examples
iosuitableviewios15

Extra padding above table view headers in iOS 15


How to change the extra padding above UITableView section headers that has started to appear in iOS 15?


Solution

  • Since iOS 15, UITableView contains a new property called sectionHeaderTopPadding which specifies the amount of padding above each section header.

    tableView.sectionHeaderTopPadding = 0.0
    

    Note: This applies only to the UITableView.Style.plain.