How do I detect when the user pressed the empty text field in a generic search bar?
1) You should set delegate property of your text field (UITextField
or UISearchBar
).
2) The you should implement in delegate following method:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
or
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
that will be called whenever user wants to enter text.