How can I show the default numeric keypad on iPhone?

I am trying the following without luck. When the user clicks on the UiText field, I need to automatically change the keyboard representation to numeric, is this possible?

+45
ios objective-c iphone uitextfield keyboard
Sep 26 '10 at 6:02
source share
5 answers

The UITextInputTraits protocol (to which UITextField corresponds) has a keyboardType property of type UIKeyboardType .

 myTextField.keyboardType = UIKeyboardTypeNumberPad; 
+93
Sep 26 '10 at 6:10
source share

This can be done in Interface Builder:

Number pad2 Number pad2

+29
Jul 05 2018-12-12T00:
source share

The UITextField follows the UITextInputTraits protocol, which means that it has a keyboardType property that you can set.

 myField.keyboardType = UIKeyboardTypeNumberPad;

You can also install it through the interface builder. From the text input signs, install the keyboard on the numeric keypad and that’s it.

+8
Sep 26 '10 at 6:19 06:19
source share

We can also get it through the interface. Select the text box and go to the attribute inspector and change the keyboard type from the keyboard drop-down list.

enter image description here

+4
Apr 20 '17 at 6:14
source share

If you want to show the numeric keypad, but also need to be able to use decimal points, currency characters, or other characters, you can by default use the keypad on the back of the alphabetic keypad.

 currentTextField.keyboardType = UIKeyboardTypeNumbersAndPunctuation; 
+2
Jul 27 '16 at 2:02
source share



All Articles