UISeachBar detect when user press Search button
Have you tried this delegate
Objective-C:
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
Swift:
func searchBarSearchButtonClicked(searchBar: UISearchBar)
See the documentation for any searchbar delegates. https://developer.apple.com/documentation/uikit/uisearchbardelegate
You've to set the searchBar delegate first.
In the viewDidLoad()
self.searchBar.delegate = self
then func searchBarSearchButtonClicked(searchBar: UISearchBar)
If you want to do something upon 'search' button get clicked then, Try this method
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
Tells the delegate that the search button was tapped.