Protocol

UISearchBarDelegate

A collection of optional methods that you implement to make a search bar control functional.

Declaration

@protocol UISearchBarDelegate

Overview

A UISearchBar object provides the user interface for a search field on a bar, but it’s the application’s responsibility to implement the actions when buttons are tapped. At a minimum, the delegate needs to perform the actual search when text is entered in the text field.

Topics

Managing the Search Text

- searchBar:textDidChange:

Tells the delegate that the user changed the search text.

- searchBar:shouldChangeTextInRange:replacementText:

Ask the delegate if text in a specified range should be replaced with given text.

- searchBarShouldBeginEditing:

Asks the delegate if editing should begin in the specified search bar.

- searchBarTextDidBeginEditing:

Tells the delegate when the user begins editing the search text.

- searchBarShouldEndEditing:

Asks the delegate if editing should stop in the specified search bar.

- searchBarTextDidEndEditing:

Tells the delegate that the user finished editing the search text.

Responding to Clicks in Search Controls

- searchBarBookmarkButtonClicked:

Tells the delegate that the bookmark button was tapped.

- searchBarCancelButtonClicked:

Tells the delegate that the cancel button was tapped.

- searchBarSearchButtonClicked:

Tells the delegate that the search button was tapped.

- searchBarResultsListButtonClicked:

Tells the delegate that the search results list button was tapped.

Responding to Scope Button Changes

- searchBar:selectedScopeButtonIndexDidChange:

Tells the delegate that the scope button selection changed.

Relationships

See Also

Handling Search Bar Interactions

delegate

The search bar’s delegate object.