Default iPad AlphaNumeric Keyboard in Digital Mode

I have a UITextField for users to enter their address. I have a default keyboard for the field.

Since most street addresses of most begin with a number, I would like it to be in digital mode by default, as if the user had already pressed a key.? 123. Thus, they can immediately begin to enter the numerical part of their address, and as soon as they press the spacebar, it will immediately switch back to alpha.

Is it possible?

+6
source share
1 answer

There are currently no settings or options that do this. You should do this programmatically by observing the input of a space with notifications through UITextFieldTextDidChangeNotification or using the delegate method textField:shouldChangeCharactersInRange:replacementString: and then switching the keyboard.

iOS is used to switch to the alphabet keyboard after a space even when using UIKeyboardTypeNumbersAndPunctuation. This has been fixed in version 5.0.

When you switch the keyboard type for the field, you really just say which keyboard to use next time it is displayed. If the keyboard is already displayed, switching the type does not change it. So, hide the keyboard, switch the type, then show it again:

 [textField1 resignFirstResponder]; [textField1.keyboardType = UIKeyboardTypeAlphabet]; [textField1 becomeFirstResponder]; 
+1
source

All Articles