0

I want to dismiss/hide UISearchController from navigation bar when I switch tabs, I tried many things, if I set it to nil a black layer is shown in the search space. The settings view controller should not present the UISearch any thoughts?

enter image description here

2 Answers2

0

Without seeing your code, this is what I would do if I wanted to hide my search bar. Use the following code to hide searchBar:

searchBar.isHidden = true

view.backgroundColor = .orange

//.clear? Or whatever colour you want to be there in the background.

//In viewDidLoad put

searchBar.isHidden = false
Habin Lama
  • 529
  • 5
  • 19
Superlative
  • 514
  • 1
  • 4
  • 14
  • It is better that I have for now, but the SearchBar is hidden without resizing the navigation bar, what I was looking for is a way to dismiss the UISearchBar like it was presented initially. As in WhatsApp, if you switch between `chat` and `settings` tabs. About the code I am instantiating a search control and adding into navigation bar `tabBarController?.navigationItem.searchController = search` – Anderson Santos Gusmão Jun 16 '19 at 23:35
0

I was adding only one Navigation Controller to all tabs, I changed it, now for each tab I have an independent navigation controller, so it is solved.