Input keyboard type - iOS
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
:
usernameField.keyboardType = .numberPad