Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show the numeric keyboard by default on iPhone?

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?

like image 472
Pablo Avatar asked Sep 26 '10 06:09

Pablo


People also ask

How do I get my iPhone keyboard to show numbers?

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.

Can you change iPhone keyboard to have numbers?

When you are typing in iOS 11, you can swipe down on the upper row of letters to add numbers.

Can iPhone keyboard show number rows?

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.


2 Answers

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

myTextField.keyboardType = UIKeyboardTypeNumberPad; 
like image 72
Jacob Relkin Avatar answered Sep 28 '22 00:09

Jacob Relkin


This could be done in the Interface Builder as well:

Number pad2 Number pad2

like image 22
Luda Avatar answered Sep 28 '22 01:09

Luda