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.
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.
Ensure that your UIViewController is set as the delegate of your UISearchBar, and that it adopts the UISearchBarDelegate protocol.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With