You need to implement the UISearchBarDelegate. Once you've done that, use:
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar Tells the delegate that the cancel button was tapped.
Then use:
[self searchBarCancelButtonClicked:yourSearchBar];