Happens only when compiled with Xcode9 and iOS 11 devices.
Section header does not automatically stick to the top leaving a space in the view through which content can be seen. (Screenshot included)
Happens when tapped for full screen.
But some times the header sticks to the top on the tap action
On scrolling up/down the header sticks to the top. (GIF included)
Correct me if I am wrong, the floating nature of section header is provided by UITableViewStyle set to plain.
tableView = UITableView()
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 44
tableView.cellLayoutMarginsFollowReadableWidth = false
tableView = UITableView(frame: self.view.frame, style: UITableViewStyle.plain)
tableView.sectionHeaderHeight = 44
// tableView.estimatedSectionHeaderHeight = 0
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "content")
tableView.register(UITableViewHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: "hContent")
tableView.dataSource = self
tableView.delegate = self
Tried to set the estimatedSectionHeaderHeight to 0 (Disable it) as suggested here. But it did not work.
We tried reloading the tableView data in our hideNavBar func as suggested here for the similar problem. But that would scroll us to some other content.
Tried the following as suggested by other answer in our hideNavBar function and again facing the same issue where we are scrolled to some distant content.
tableView.reloadData()
tableView.layoutIfNeeded()
tableView.beginUpdates()
tableView.endUpdates()