I have a UISearchController
above a UITableView
, popping up from a UIButton
on a UIViewController
.
All was well. Then iOS 11.0 came and a different set-up was needed.
And then iOS 13.0 came out and the UISearchBar
wasn't visible in the UI. I've added a special-case: the search bar is now visible. But there is a gap between the bottom of the search bar and the top of the table. A user can scroll table rows up to fill this gap and back down to reveal the gap.
How can I get rid of this gap?
Code:
if #available(iOS 13.0, *) {
// my attempt at getting a correct setup
self.navigationItem?.searchController = searchController
table.tableHeaderView = searchController?.searchBar
} else if #available(iOS 11.0, *) {
self.navigationItem = navigationItem
} else {
table.tableHeaderView = searchController?.searchBar
}