Search code examples
iosobjective-cuisearchbaruisearchdisplaycontroller

Don't show UISearchDisplayController results view until search tapped


How do I disable showing the search results view until the search button is tapped?

I want the dark modal appearance to stay also, I don't want to just see the "No Results" background.

It seems like I will have to intercept the text fields change event but I'm hoping there is a less hacky way to do it.


Solution

  • Do one thing filter data in this event:

    - (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText
    

    but reload tableview data when search button is tapped.