Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextField with numbers and default keyboard

Created a UITextField for "Postal Code/ZIP" field with a keyboardType of UIKeyboardTypeDefault. I would like to use the default keyboard but want the numbers & symbols to be shown by default as apposed to letters.

Apple does this when you are entering addresses in the Contacts.app.

Anyone know how to get this accomplished?

like image 911
nesbert Avatar asked Apr 22 '10 23:04

nesbert


2 Answers

You want the UIKeyboardTypeNumbersAndPunctuation keyboard type.

like image 167
executor21 Avatar answered Oct 24 '22 09:10

executor21


And a code example of what executor21 said:

UITextField* txt = [[UITextField alloc] init];
txt.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
like image 38
Joel Avatar answered Oct 24 '22 07:10

Joel