Protocol: UISearchBarDelegate
Overview
The UISearchBarDelegate protocol defines the optional methods you implement to make a UISearchBar control functional. 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.Tells the delegate that the scope button selection changed.Ask the delegate if text in a specified range should be replaced with given text.Tells the delegate that the user changed the search text.Tells the delegate that the bookmark button was tapped.Tells the delegate that the cancel button was tapped.Tells the delegate that the search results list button was tapped.Tells the delegate that the search button was tapped.Asks the delegate if editing should begin in the specified search bar.Asks the delegate if editing should stop in the specified search bar. Tells the delegate when the user begins editing the search text.Tells the delegate that the user finished editing the search text.
Instance Method Summary (collapse)
-
- searchBar:selectedScopeButtonIndexDidChange:
Tells the delegate that the scope button selection changed.
-
- searchBar:shouldChangeTextInRange:replacementText:
Ask the delegate if text in a specified range should be replaced with given text.
-
- searchBar:textDidChange:
Tells the delegate that the user changed the search text.
-
- searchBarBookmarkButtonClicked:
Tells the delegate that the bookmark button was tapped.
-
- searchBarCancelButtonClicked:
Tells the delegate that the cancel button was tapped.
-
- searchBarResultsListButtonClicked:
Tells the delegate that the search results list button was tapped.
-
- searchBarSearchButtonClicked:
Tells the delegate that the search button was tapped.
-
- searchBarShouldBeginEditing:
Asks the delegate if editing should begin in the specified search bar.
-
- searchBarShouldEndEditing:
Asks the delegate if editing should stop in the specified search bar.
-
- searchBarTextDidBeginEditing:
Tells the delegate when the user begins editing the search text.
-
- searchBarTextDidEndEditing:
Tells the delegate that the user finished editing the search text.
Instance Method Details
- (Object) searchBar(searchBar, selectedScopeButtonIndexDidChange:selectedScope)
Tells the delegate that the scope button selection changed.
- (Boolean) searchBar(searchBar, shouldChangeTextInRange:range, replacementText:text)
Ask the delegate if text in a specified range should be replaced with given text.
- (Object) searchBar(searchBar, textDidChange:searchText)
Tells the delegate that the user changed the search text. This method is also invoked when text is cleared from the search text field.
- (Object) searchBarBookmarkButtonClicked(searchBar)
Tells the delegate that the bookmark button was tapped. There is no automatic bookmark support provided by the search bar. It’s the application’s responsibility to implement this method to perform some action if the bookmark button is tapped by the user.
- (Object) searchBarCancelButtonClicked(searchBar)
Tells the delegate that the cancel button was tapped. Typically, you implement this method to dismiss the search bar.
- (Object) searchBarResultsListButtonClicked(searchBar)
Tells the delegate that the search results list button was tapped.
- (Object) searchBarSearchButtonClicked(searchBar)
Tells the delegate that the search button was tapped. You should implement this method to begin the search. Use the text property of the search bar to get the text. You can also send becomeFirstResponder to the search bar to begin editing programmatically.
- (Boolean) searchBarShouldBeginEditing(searchBar)
Asks the delegate if editing should begin in the specified search bar.
- (Boolean) searchBarShouldEndEditing(searchBar)
Asks the delegate if editing should stop in the specified search bar.
- (Object) searchBarTextDidBeginEditing(searchBar)
Tells the delegate when the user begins editing the search text.
- (Object) searchBarTextDidEndEditing(searchBar)
Tells the delegate that the user finished editing the search text. Typically, you implement this method to perform the text-based search.