0
votes

I'm using a UINavigationBar ALWAYS hidden (I'm using NavigationBar facilities to push ou pop views but I'm not showing it to final user), the problem is that in one of those views I have a tableView with UISearchBar. When I select the searchBar, make a search and click on it's "Cancel" button the NavigationBar appears, but I want to keep the Navigation hidden as it is.

I've tried to hidden the navigationBar one more time by willDismissSearchController or didDismissSearchController by

func willDismissSearchController(searchController: UISearchController) {
    self.navigationController?.navigationBar.hidden = true
}

but it did not worked as I want.

Thank you in advance.

1

1 Answers

0
votes

I've found a solution, so as it is a unusual question I'll reply for other people know the solution.

the following code did worked for me:

override func viewDidLayoutSubviews() {
    self.navigationController?.navigationBar.hidden = true
}