iOS Developer Library

Developer

UISearchDisplayDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

UISearchDisplayDelegate

Inherits From


Not Applicable

Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 3.0 and later

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.

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

    Declaration

    Swift

    optional func searchDisplayControllerWillBeginSearch(_ controller: UISearchDisplayController)

    Objective-C

    - (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller

    Parameters

    controller

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0

  • Tells the delegate that the controller has started searching.

    Declaration

    Swift

    optional func searchDisplayControllerDidBeginSearch(_ controller: UISearchDisplayController)

    Objective-C

    - (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller

    Parameters

    controller

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0

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

    Declaration

    Swift

    optional func searchDisplayControllerWillEndSearch(_ controller: UISearchDisplayController)

    Objective-C

    - (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller

    Parameters

    controller

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0

  • Tells the delegate that the controller has finished searching.

    Declaration

    Swift

    optional func searchDisplayControllerDidEndSearch(_ controller: UISearchDisplayController)

    Objective-C

    - (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller

    Parameters

    controller

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0

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

    Declaration

    Swift

    optional func searchDisplayController(_ controller: UISearchDisplayController, didLoadSearchResultsTableView tableView: UITableView)

    Objective-C

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0

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

    Declaration

    Swift

    optional func searchDisplayController(_ controller: UISearchDisplayController, willUnloadSearchResultsTableView tableView: UITableView)

    Objective-C

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0

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

    Declaration

    Swift

    optional func searchDisplayController(_ controller: UISearchDisplayController, willShowSearchResultsTableView tableView: UITableView)

    Objective-C

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0

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

    Declaration

    Swift

    optional func searchDisplayController(_ controller: UISearchDisplayController, didShowSearchResultsTableView tableView: UITableView)

    Objective-C

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0

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

    Declaration

    Swift

    optional func searchDisplayController(_ controller: UISearchDisplayController, willHideSearchResultsTableView tableView: UITableView)

    Objective-C

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0

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

    Declaration

    Swift

    optional func searchDisplayController(_ controller: UISearchDisplayController, didHideSearchResultsTableView tableView: UITableView)

    Objective-C

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

    Import Statement

    Objective-C

    @import UIKit;

    Swift

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

    Objective-C

    @import UIKit;

    Swift

    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

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later

    Deprecated in iOS 8.0