Use searchBarSearchButtonClicked:
delegate method of UISearchBar
if you need to search only after pressing search button.
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
//Do search logic here
}
Don't forget set the delegate
of UISearchBar
. If you don't need to filter items after each character entry remove - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
delegate method.
Hope this helps