Reputation: 73
As the bellow pics:
There are 2 states for UISearchBar
, how can I judge the searchBar's state?
Upvotes: 1
Views: 291
Reputation: 142
I think searchBar.isFirstResponder is the property you're looking for.
Upvotes: 1
Reputation: 1017
On Swift I use this, I'm sure have anything like that to obj-c
func searchBarTextDidBeginEditing(searchBar: UISearchBar) {
searchActive = true;
}
func searchBarTextDidEndEditing(searchBar: UISearchBar) {
searchActive = false;
}
func searchBarCancelButtonClicked(searchBar: UISearchBar) {
searchActive = false;
}
func searchBarSearchButtonClicked(searchBar: UISearchBar) {
searchActive = false;
}
Upvotes: 2