I am using UISearchController to search for data in my tableview. I am not using table view controller. I would like to hide the navigation bar when my search b
Reseting tableView.tableHeaderView = searchController.searchBar after the dismissing searchController solved the issue for me.
public func didDismissSearchController(_ searchController: UISearchController) {
tableView.tableHeaderView = searchController.searchBar
}
Unfortunately didDismissSearchController doesn't get called if you select a result and go back to parent viewController.
In this case you need reset the searchBar.frame back to origin position:
if let frame = tableView.tableHeaderView?.frame {
searchController.searchBar.frame = frame
}