TextField Keyboard startup in Number mode
I need the UITextField "ASCII Capab开发者_JS百科le" keyboard to come up in numeric mode. I can't find an API for this, what am I missing?
Assuming you have a UITextField
named textField
, all you need to do is call the method:
[ textField setKeyboardType:UIKeyboardTypeNumbersAndPunctuation ];
You may need to call this before the keyboard is displayed.
from the documentation does this help?
The appearance of the keyboard itself can be customized using the properties provided by the UITextInputTraits protocol. Text field objects implement this protocol and support the properties it defines. You can use these properties to specify the type of keyboard (ASCII, Numbers, URL, Email, and others) to display. You can also configure the basic text entry behavior of the keyboard, such as whether it supports automatic capitalization and correction of the text.
Are you using Interface Builder? If so, click on the text field, then go to the Text Field Attributes. There will be an attribute for Keyboard. Change it to Number Pad.
精彩评论