Table View Searching
A table view is a common way to present the results of a search performed through a search field (a UISearchBar; see Chapter 25). This is such a standard interface, in fact, that a class is provided, UISearchDisplayController, to mediate between the search field where the user enters a search term and the table view listing the results of the search. The UISearchDisplayController needs the following things:
- A search bar
A UISearchBar in the interface. This will be the UISearchDisplayController’s
- A view controller
The controller managing the view in the interface over which the search results are to appear. This will be the UISearchDisplayController’s
searchContentsController. The UISearchDisplayController will harness this view controller’s view and present its table of results modally on top of it.
- A table view
The table view in which the search results will be presented. This will be the UISearchDisplayController’s
searchResultsTableView. It can already exist, or the UISearchDisplayController will create it.
- A data source and delegate for the table view
searchResultsDelegate. They will control the data and structure of the search results table. They are commonly the same object, as for any table view; moreover, they are commonly the view controller.
- A delegate
- An optional object adopting the UISearchDisplayDelegate protocol. It will be notified of events relating to the display ...