Reputation: 1256
HI i have implemented Searchbar in Navigationbar and
Hiding Navigationbar Progamatically but the space is not removing PLease help how can i remove the space of searchbar hiding space
let search = UISearchController(searchResultsController: nil)
search.searchResultsUpdater = self
search.obscuresBackgroundDuringPresentation = false
search.hidesNavigationBarDuringPresentation = false;
search.searchBar.placeholder = "search..."
self.definesPresentationContext = true
self.navigationItem.searchController = search
for Hiding the SearchBar
search.searchBar.isHidden = false
Upvotes: 0
Views: 663
Reputation: 1292
Hiding it won't be enough because it is still the navigationItem
searchController
, so you need to set it to nil
self.navigationItem.searchController = nil
and later restore it if you want, simple as that.
Upvotes: 1