searchBarCancelButtonClicked delegate method is not called. Is there any way to call?

iphone, uisearchbar, uisearchbardelegate

Solution

The reason why searchBarCancelButtonClicked does not fire may be because your UISearchBar does not show the Cancel button. You can display the Cancel button like this:

searchBar.showsCancelButton = true

I had the same problem and making the Cancel button show made searchBarCancelButtonClicked fire as expected.

Problem

UIViewController to implement a view to placing an UITableView UISearchBar and being implemented. But you can not call searchBarCancelButtonClicked. Do not know what the reason.

Original source

Related problems