I use a table view with a UISearchDisplayController
in conjunction with a UISearchBar
. The search bar automatically hides the cancel button when inappropriate, but I'm using the view controller in a modal state - so I would like to always show the cancel button and use it to pop the modal view controller when the search is cancelled.
Is there a way to force the cancel button to stay visible without creating a custom search bar?
you should use the display delegate
- (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller
{
controller.searchBar.showsCancelButton = YES;
}
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