I'm trying the following with no luck. When the user click on a UiTextfield I need to change the keyboard view to the numeric view automatically, is this possible?
If a keyboard isn't already visible, tap the Show Keyboard button , then tap the Formula Keyboard button to begin editing a formula. To quickly enter a number or symbol on an iPad, drag down on a key and then lift your finger, or switch to the numeric keyboard on iPhone.
When you are typing in iOS 11, you can swipe down on the upper row of letters to add numbers.
Last time I checked, if I wanted to use numbers on my iPhone, I tapped on the 123 button in the lower left corner of the keyboard and the number row, as well as other punctuation and symbols keyboard appears.
The UITextInputTraits
protocol (which UITextField
conforms to) has a keyboardType
property of type UIKeyboardType
.
myTextField.keyboardType = UIKeyboardTypeNumberPad;
This could be done in the Interface Builder as well:
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