IOS UISearchBar learning notes
UISearchBar is a search control that provides a text input box, a search button, a bookmarks button, and a Cancel button. We need to use the UISearchBarDelegate proxy for search;
Drag a UISearchBar Control
Right sidebar attributes <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20141010/2014101008183216.jpg" alt = "\">
Text is the default text. The placeholder is the text displayed when the text is not edited. The prompt is the text displayed on the text box.
The preceding figure shows the corresponding text.
Continue attributes
These two attributes are used to set the style:
Used to set buttons;
The styles corresponding to the four buttons;
We can also set the background image:
They are
The above is used to set the background image, and the following is used to set the background image (when the fourth button scope bar is selected)
Next let's take a look at the Proxy: UIBarPositioningDelegate
Editing Text-searchBar: textDidChange: // when the search content changes, call-searchBar: shouldChangeTextInRange: replacementText: // This should replace the previous Text range with the last Text-searchBarShouldBeginEditing: // make the search box editable-searchBarTextDidBeginEditing: // call-searchBarShouldEndEditing: // when the user starts to edit the text-enable searchBarTextDidEndEditing: // call Clicking Buttons-searchBarBookmarkButtonClicked when the user finishes editing the text: // call-searchBarCancelButtonClicked when the user clicks the bookmark button: // call-searchBarSearchButtonClicked when the user clicks the cancel button: // call-searchBarResultsListButtonClicked when you click the search Button: // call Scope Button-searchBar: selectedScopeButtonIndexDidChange: // when the scope Button changes
You can take a look at common proxy Methods: Click to open the link