typedef NS_ENUM(NSInteger, UIKeyboardType) {
UIKeyboardTypeDefault, // Default type for the current input method.
UIKeyboardTypeASCIICapable, // Displays a keyboard which can enter ASCII characters
UIKeyboardTypeNumbersAndPunctuation, // Numbers and assorted punctuation.
UIKeyboardTypeURL, // A type optimized for URL entry (shows . / .com prominently).
UIKeyboardTypeNumberPad, // A number pad with locale-appropriate digits (0-9, ?-?, ?-?, etc.). Suitable for PIN entry.
UIKeyboardTypePhonePad, // A phone pad (1-9, *, 0, #, with letters under the numbers).
UIKeyboardTypeNamePhonePad, // A type optimized for entering a person's name or phone number.
UIKeyboardTypeEmailAddress, // A type optimized for multiple email address entry (shows space @ . prominently).
UIKeyboardTypeDecimalPad API_AVAILABLE(ios(4.1)), // A number pad with a decimal point.
UIKeyboardTypeTwitter API_AVAILABLE(ios(5.0)), // A type optimized for twitter text entry (easy access to @ #)
UIKeyboardTypeWebSearch API_AVAILABLE(ios(7.0)), // A default keyboard type with URL-oriented addition (shows space . prominently).
UIKeyboardTypeASCIICapableNumberPad API_AVAILABLE(ios(10.0)), // A number pad (0-9) that will always be ASCII digits.
UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable, // Deprecated
};
UIKeyboardTypeDefault
- 默認(rèn)樣式
- 可以輸入數(shù)字、字母议纯、符號(hào)、emoji
-
可輸入中文,以及中/英切換
UIKeyboardTypeASCIICapable
- 只能輸入數(shù)字步责、字母和符號(hào),不能輸入emoji和中文
-
適合輸入密碼等場(chǎng)景
UIKeyboardTypeASCIICapable
UIKeyboardTypeNumbersAndPunctuation
-
只能輸入數(shù)字肮蛹、字母勺择、符號(hào)和中文,不能輸入emoji
UIKeyboardTypeNumbersAndPunctuation
UIKeyboardTypeURL
- 可以輸入數(shù)字伦忠、字母省核、符號(hào)、emoji和中文
- 提供URL常用的
.com
昆码、.
气忠、/
熱鍵
UIKeyboardTypeNumberPad
UIKeyboardTypePhonePad
- 只能輸入0~9的純數(shù)字邻储,和
+ * #
符號(hào)
-
適合輸入電話號(hào)碼場(chǎng)景
UIKeyboardTypeNamePhonePad
- 可以輸入字母、數(shù)字旧噪、emoji和中文吨娜,不能輸入特殊符號(hào)
- 能方便輸入中/英文及數(shù)字
-
適用于聯(lián)系人場(chǎng)景
UIKeyboardTypeNamePhonePad
UIKeyboardTypeEmailAddress
- 可以輸入字母、數(shù)字淘钟、符號(hào)宦赠、emoji和中文
- 提供Email常用的
@
、.
熱鍵
-
適合輸入郵箱場(chǎng)景
UIKeyboardTypeEmailAddress
UIKeyboardTypeDecimalPad
- 可以輸入0~9純數(shù)字及小數(shù)點(diǎn)
.
-
適合含小數(shù)場(chǎng)景
UIKeyboardTypeTwitter
- 可以輸入字母米母、數(shù)字勾扭、符號(hào)、emoji和中文
- 提供
@
铁瞒、#
熱鍵
UIKeyboardTypeWebSearch
- 可以輸入字母妙色、數(shù)字、符號(hào)慧耍、emoji和中文
- 提供
.
身辨、go
熱鍵
-
適合搜索場(chǎng)景
UIKeyboardTypeASCIICapableNumberPad
- 只能輸入0~9純數(shù)字,iOS 10及以后才能使用
-
適合純數(shù)字場(chǎng)景
UIKeyboardTypeASCIICapableNumberPad
UIKeyboardTypeAlphabet - 已廢棄