I need a UIKeyboard that display the default UIKeyboardType without the number 0-9. I only need to hide those buttons.
Is there a way to access the the different button of the keyboard so i could set then hidden?
If no, can i detect when the “.?123” button is pressed AND add a subview to cover the first row?
Or any pointer to a better approach?
There is no public API for disabling access to the number and punctuation keys. You could dig through the keyboard’s view hierarchy to try to hide the number toggle key, but that is likely to break in the future (the keyboard view hierarchy has changed in the past).
It would be much simpler to just filter out the characters you don’t like in your text control’s delegate. For example, let’s say you only want to allow the user to type in letters. If you have a
UITextField, set its delegate to your view controller and implement this method in your view controller:If you have a
UITextView, the method is calledtextView:shouldChangeTextInRange:replacementText:.