IOS8 Swift UISearchController hides navigation bar

I implemented a search function for the UITableViewController as follows:

self.resultSearchController = ({ let controller = UISearchController(searchResultsController: nil) controller.searchResultsUpdater = self controller.dimsBackgroundDuringPresentation = false controller.searchBar.sizeToFit() self.tableView.tableHeaderView = controller.searchBar return controller })() 

The problem I am facing is that if I click on it, my navigation bar and the title of the navigation controllers will disappear. Is there a solution to stop this behavior (in quick)?

Button not pressed:

Not clicked

Clicked:

Clicked

+6
source share
1 answer

UISearchController has the hidesNavigationBarDuringPresentation property, maybe this can help you.

EDIT: just tried it myself and it works, just add this line:

 searchController.hidesNavigationBarDuringPresentation = false 
+12
source

Source: https://habr.com/ru/post/983003/


All Articles