I want to be able to search for a String without any character in it. The problem is, that the default keyboard does not show up the search button, when there is nothing written in the UISearchBar.
Any idea?
Thanks, Markus
Luckily, I just happened to be working on code that does exactly this. It's a bit of a hack, but you can find the UITextField that is embedded within the UISearchBar, then turn off enablesReturnKeyAutomatically
:
UITextField *searchBarTextField = nil;
for (UIView *subview in searchBar.subviews)
{
if ([subview isKindOfClass:[UITextField class]])
{
searchBarTextField = (UITextField *)subview;
break;
}
}
searchBarTextField.enablesReturnKeyAutomatically = NO;
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