Reputation: 8376
I have a UINavigationController
that has a UISearchController
assigned to the navigationItem's searchController
. Inside the view I have a UICollectionView
. The search bar displays in the navigation bar, but when I scroll, the navigation bar automatically hides. Can I stop this from happening?
let searchController = UISearchController(searchResultsController: recentSearchesViewController)
searchController.searchResultsUpdater = recentSearchesViewController
searchController.dimsBackgroundDuringPresentation = true
definesPresentationContext = true
navigationItem.searchController = searchController
Upvotes: 2
Views: 1392
Reputation: 7485
You have to set :
navigationItem.hidesSearchBarWhenScrolling = false
Upvotes: 1