Is there any way to disable the keyboard's search or enter buttons in iOS?
I'd like to disable these while the text in my UISearchBar is too short to commit a search.
Is there any way to disable the keyboard's search or enter buttons in iOS?
I'd like to disable these while the text in my UISearchBar is too short to commit a search.
There is a very simple solution to this with no UI hacks, no accessing Apple private apis and such. Simply add this to viewDidLoad.
yourSearchBar.enablesReturnKeyAutomatically = true
As per Apples documentation:
If you set it to true, the keyboard disables the Return key when the text entry area contains no text. As soon as the user enters some text, the Return key is automatically enabled.