0

I am using UISearchController to provide a search functionality in my app. The user can type for location, or if clicks on Use current location, i will get the location.

But when clicking on Search, the editable search field and cancel button appear and dim the background. The table view appears only on typing a character.

How do i display the table view as soon as user clicks on Search?

The way I am creating a UISearch controller here is like this:

let locationController = UISearchController(searchResultsController: locationSearchController)
locationController.searchBar.delegate = self
self.presentViewController(locationController, animated: true, completion: nil)

Note: I am not using UISearchResultsUpdating method. I am using custom delegate to reload the table view from the parent ViewController.

I want to show Last 2 options in the 2nd image as soon as user clicks Search See attached snapshots.

On Clicking Search Icon I want to show Last 2 options as soon as user clicks Search

kishorer747
  • 810
  • 1
  • 10
  • 24
  • You can take a look at this: http://stackoverflow.com/questions/30790244/uisearchcontroller-show-results-even-when-search-bar-is-empty – Onur Jun 20 '16 at 14:45
  • @Onur, thanks for the link, but i could not get it to work. No matter what, on clicking search, the table view is still hidden. But if i click Space or any other character, the table appears. – kishorer747 Jun 20 '16 at 19:04
  • See my answer here: https://stackoverflow.com/a/46123675/341994 – matt Sep 08 '17 at 19:54

0 Answers0