With iOS 15 beta and Xcode 13 beta 2 some custom UITableViewControllers has decided to add padding between the navigation bar and the table view.
Steps to reproduce:
Add two UITableViewControllers so the structure looks like this: UINavigationController -> UITableViewController -> UITableViewController.
Add table view delegate method heightForHeaderInSection and return a small value.
In viewDidLoad or viewWillAppear methods make a API call.
Actions to solve the problem:
[self.tableView setSectionHeaderTopPadding:0.0f]; // Not working
[self.tableView setContentInset:-35.0f]; // Works but is not dynamic
Tested on Xcode 13 beta 2, iOS 15 beta 2, iPhone 12 Simulator, iPhone Xs
Demo project showing the issue: Github link
The header section should only be 30 pt/px but it's clearly not:
Link to original Apple Developer forum thread
You can try using UITableView.sectionHeaderTopPadding
like this -
if #available(iOS 15, *) {
tableView.sectionHeaderTopPadding = 0
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With