Input keyboard type on iOS
Setting the keyboard type for input fields helps user entering data. For example, if users need to enter a number, it helps to show a numeric keyboard. If users need to enter an e-mail address, it helps if the at-key (@
) is shown. You should always set an appropriate keyboard type.
On iOS, you can set a keyboard type by using the keyboardType
property.
The following types are defined:
asciiCapable
: a keyboard that displays standard ASCII charactersasciiCapableNumberPad
: a number pad that outputs only ASCII digitsdecimalPad
: a keyboard with numbers and a decimal pointdefault
: the default keyboardemailAddress
: a keyboard for entering email addressesnamePhonePad
: a keypad for entering a person’s name or phone numbernumberPad
: a numeric keypad for PIN entrynumbersAndPunctuation
: a keyboard for numbers and punctuationphonePad
: a keypad for entering telephone numbersURL
: a keyboard for URL entrytwitter
: a keyboard for Twitter text entry, with easy access to the at '@
' and hash '#
' characterswebSearch
: a keyboard for web search terms and URL entry
Example of using keyboardType
: