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. More...

Inheritance


Not Applicable

Import Statement


import UIKit @import UIKit;

Availability


Available in iOS 3.0 and later.
  • Asks the delegate if the table view should be reloaded for a given search string.

    Declaration

    Swift

    optional func searchDisplayController(_ controller: UISearchDisplayController, shouldReloadTableForSearchString searchString: String!) -> Bool

    Objective-C

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

    Import Statement

    import UIKit

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 8.0.

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

    Declaration

    Swift

    optional func searchDisplayController(_ controller: UISearchDisplayController, shouldReloadTableForSearchScope searchOption: Int) -> Bool

    Objective-C

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

    Import Statement

    import UIKit

    Availability

    Available in iOS 3.0 and later.

    Deprecated in iOS 8.0.