iOS Developer Library

Developer

UISearchDisplayDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

UISearchDisplayDelegate

Important: UISearchDisplayDelegate is deprecated in iOS 8. (Note that UISearchDisplayController is also deprecated.) To manage the presentation of a search bar and display search results in iOS 8 and later, instead use UISearchControllerDelegate.

This protocol defines delegate methods for UISearchDisplayController objects.

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

    Declaration

    - (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

    YEStrue if the display controller should reload the data in its table view, otherwise NOfalse.

    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 NOfalse. You would reload the table when you have results.

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

    Declaration

    - (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

    YEStrue if the display controller should reload the data in its table view, otherwise NOfalse.

    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 NOfalse, and reload the table when you have results.