I want the user to be able to type in only numbers and spaces. I set the keyboardType textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
but if a user hits space, the keyboard layout switches to letters.
So the user has to switch after each space to the number layout which I want to stop.
I know I can stop entering any spaces by the textfield delegate method shouldChangeCharactersInRange
or or the NumberPad Layout but I want the spaces to display.
Is there a workaround for this?
Potentially you could use the keyboard layout suggested here but instead of a "Done" button you could include a "_" spacebar button? This has the added benefit of preventing the user from selecting any punctuation.
An alternate answer to specifically the behavior you're seeing is found in this other post.