I have a UISearchDisplayController that shows the cancel button. I would like to call a method when a user clicks the cancel button. Is there a way to do this?
You can use the following searchbar delegate method,
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
// DO ur operations
}
For UISearchDisplayController, the following 2 methods can be considered.
- (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller
{
NSLog(@"WillEndSearch");
}
- (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller
{
NSLog(@"DidEndSearch");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.