带有数字和默认键盘的UITextField

nes*_*ert 6 iphone cocoa-touch objective-c iphone-softkeyboard

使用keyboardType为UIKeyboardTypeDefault的"Postal Code/ZIP"字段创建了UITextField.我想使用默认键盘,但希望数字和符号默认显示为与字母相对应.

当您在Contacts.app中输入地址时,Apple会执行此操作.

有谁知道怎么做到这一点?

exe*_*r21 7

你想要UIKeyboardTypeNumbersAndPunctuation键盘类型.


Joe*_*oel 6

以及executor21所说的代码示例:

UITextField* txt = [[UITextField alloc] init];
txt.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
Run Code Online (Sandbox Code Playgroud)