Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit iOS keyboard to numeric input

The question pretty much says it all. Is there any way to have the iOS/iPhone keyboard default to numeric input?

like image 286
Jack BeNimble Avatar asked Sep 14 '11 00:09

Jack BeNimble


People also ask

How do I get my iPhone keyboard to stay on numbers?

Try this: When entering numbers from the numbers keyboard, and you wish to insert a space, simply press the ABC key, and SLIDE your finger onto the space bar. When you lift your finger, a space will have been inserted, and you will remain in the numerical keyboard.


1 Answers

Set the keyboardType property of the UITextField to UIKeyboardTypeDecimalPad.

Swift 3

yourUITextField.keyboardType = .decimalPad

like image 60
Ravi Avatar answered Sep 20 '22 06:09

Ravi