UISearchDisplayDelegate Protocol Reference

Conforms to
Availability
Available in iOS 3.0 and later.
Declared in
UISearchDisplayController.h
Related sample code

Overview

This protocol defines delegate methods for UISearchDisplayController objects.

Tasks

Search State Change

Loading and Unloading the Table View

Showing and Hiding the Table View

Responding to Changes in Search Criteria

Instance Methods

searchDisplayController:didHideSearchResultsTableView:

Tells the delegate that the controller just hid its table view.

- (void)searchDisplayController:(UISearchDisplayController *)controller didHideSearchResultsTableView:(UITableView *)tableView
Parameters
controller

The search display controller for which the receiver is the delegate.

tableView

The search display controller’s table view.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayController:didLoadSearchResultsTableView:

Tells the delegate that the controller has loaded its table view.

- (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView
Parameters
controller

The search display controller for which the receiver is the delegate.

tableView

The search display controller’s table view.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayController:didShowSearchResultsTableView:

Tells the delegate that the controller just displayed its table view.

- (void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView
Parameters
controller

The search display controller for which the receiver is the delegate.

tableView

The search display controller’s table view.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayController:shouldReloadTableForSearchScope:

Asks the delegate if the table view should be reloaded for a given scope.

- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption
Parameters
controller

The search display controller for which the receiver is the delegate.

searchOption

The index of the selected scope button in the search bar.

Return Value

YES if the display controller should reload the data in its table view, otherwise NO.

Discussion

If you don’t implement this method, then the results table is reloaded as soon as the scope button selection changes.

You might implement this method if you want to perform an asynchronous search: you would initiate the search in this method, then return NO, and reload the table when you have results.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayController:shouldReloadTableForSearchString:

Asks the delegate if the table view should be reloaded for a given search string.

- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
Parameters
controller

The search display controller for which the receiver is the delegate.

searchString

The string in the search bar.

Return Value

YES if the display controller should reload the data in its table view, otherwise NO.

Discussion

If you don’t implement this method, then the results table is reloaded as soon as the search string changes.

You might implement this method if you want to perform an asynchronous search. You would initiate the search in this method, then return NO. You would reload the table when you have results.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayController:willHideSearchResultsTableView:

Tells the delegate that the controller is about to hide its table view.

- (void)searchDisplayController:(UISearchDisplayController *)controller willHideSearchResultsTableView:(UITableView *)tableView
Parameters
controller

The search display controller for which the receiver is the delegate.

tableView

The search display controller’s table view.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayController:willShowSearchResultsTableView:

Tells the delegate that the controller is about to display its table view.

- (void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView
Parameters
controller

The search display controller for which the receiver is the delegate.

tableView

The search display controller’s table view.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayController:willUnloadSearchResultsTableView:

Tells the delegate that the controller is about to unload its table view.

- (void)searchDisplayController:(UISearchDisplayController *)controller willUnloadSearchResultsTableView:(UITableView *)tableView
Parameters
controller

The search display controller for which the receiver is the delegate.

tableView

The search display controller’s table view.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayControllerDidBeginSearch:

Tells the delegate that the controller has started searching.

- (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller
Parameters
controller

The search display controller for which the receiver is the delegate.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayControllerDidEndSearch:

Tells the delegate that the controller has finished searching.

- (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller
Parameters
controller

The search display controller for which the receiver is the delegate.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayControllerWillBeginSearch:

Tells the delegate that the controller is about to begin searching.

- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller
Parameters
controller

The search display controller for which the receiver is the delegate.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h

searchDisplayControllerWillEndSearch:

Tells the delegate that the controller is about to end searching.

- (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller
Parameters
controller

The search display controller for which the receiver is the delegate.

Availability
  • Available in iOS 3.0 and later.
Declared In
UISearchDisplayController.h