For iPhone development, is there any UI/UX pattern I should be following with the UISearchBar
to permit both filtering and searching?
My use case is one screen were we display nearby in a UITableView
nearby restaurants pulled from Yelp. Above the restaurants we have a search bar. When the user initially displays this screen, we display the nearest 30 or so restaurants from Yelp. Now above the UITableView
we have a UISearchBar
; entering text into the search bar will filter the 30 or so restaurants displayed (like filtering your Contacts), but if you're in a city with a high density of restaurants, you may be looking for a restaurant that is not on that list. Now I want the search bar to not filter, but actually search, whereby I can use their input as a query parameter in a HTTP request to Yelp in an attempt to retrieve the restaurant that they actually want.
Any patterns or inspiration on the best way to do this? The iPhone HIG says that I can enable a "results list" icon for the search bar that "indicates the presence of search results. When users tap the results list icon, your app can display the results of their most recent search." Does this mean that the Search button the keyboard will really filter, and pressing the results list icon will actually perform a search? Any examples of its usage anywhere?
Right now I'm leaning toward displaying a "Search for a restaurant..." row above the 30 or so restaurants initially displayed. When the user presses that, they go to another screen with a search bar fixed at the top. Whenever they activate the search bar and press the Search button on the keyboard, it issues a new query to Yelp. Note that this basically does away with filtering on both screens (although the latter is implicitly filtered by your query), but at least it's understandable.