I have a problem with the UISearchController in combination with UITabBarController. I have 3 tabs. In every tab, I have an UITableViewController with a search bar from UISearchController set as header view of the table view as follows.
searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
searchController.hidesNavigationBarDuringPresentation = true
tableView.tableHeaderView = searchController.searchBar
tableView.contentOffset = CGPointMake(0, CGRectGetHeight(searchController.searchBar.frame))
If I start searching and switch to the other tab without canceling the search and then return back to previous tab, the content of the UITableView become black. I have read multiple postings such as UISearchController makes the controller black or UISearchController causes black screen Swift 2.0. But these solutions do not work for me. If I am setting
definesPresentationContext = true
then the problem first occur. If I omit this line then the content of the table view are not becomming black but the search bar stay activated in a searching state on the next tab. I also tried setting searchResultsController to another UITableViewController but it does not solve the problem too.