Is it possible to use the UISearchController
without the SearchBar
being displayed in the Navigation Controller
? I basically want the SearchBar
to stay on the screen and display the TableView beneath it:
What I was trying to do is this:
I've created a UITableViewController
on the storyboard and linked it to the custom NPTableViewController
class. Then I did this:
let resultsTable = storyboard!.instantiateViewController(withIdentifier: "LocationSearch") as! NPTableViewController
searchController = UISearchController(searchResultsController: resultsTable)
searchController?.searchResultsUpdater = resultsTable
let searchBar = searchController!.searchBar
searchBar.sizeToFit()
searchBar.placeholder = "Search for places"
searchBar.frame.origin.y = 100.0
self.view.addSubview(searchBar)
Now when I run it, the searchBar
is displayed but when I click on it the background dims, the searchBar
disappears my resultsTable
is also not displayed.