Yes, I have read a lot of other posts on this issue, none of the solutions have worked for me yet!
Basically, when I use viewForFooterInSection and heightForFooterInSection, the resulting footer "floats"
viewDidLoad and FooterView code:
override func viewDidLoad() {
super.viewDidLoad()
setupNaviationBarStyles()
setUpNavBarButtons()
navigationItem.title = "Kindle"
tableView.register(BookCell.self, forCellReuseIdentifier: "cellId")
tableView.backgroundColor = UIColor.lightGray
fetchBooks()
}
override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
view.backgroundColor = .red
return view
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 50
}
The problem seems to be specific to the iPhone x? In the iPhone 7 simulator the above code works perfectly:
I have tried to create a custom view in viewDidLoad like a lot of other threads suggested but no such luck yet:
let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width:
tableView.frame.size.width, height: 40))
view.backgroundColor = .red
self.tableView.tableFooterView = view
I appreciate any help around this issue, seems like the solution is probably simple but I have been researching for a while and haven't found anything to be very effective when simulating using an iPhone x.
Cheers!
It's Apple's bug, not yours. They completely failed to think through the implications of the iPhone X.
All you can really do is set the navigation controller's isToolbarHidden
to false
, even though you have no toolbar content. That will take up the space behind the home indicator and the table will look decent.
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