1、键盘风格
typedef NS_ENUM(NSInteger, UIKeyboardType) {UIKeyboardTypeDefault, // Default type for the current input method.UIKeyboardTypeASCIICapable, // Displays a keyboard which can enter ASCII charactersUIKeyboardTypeNumbersAndPunctuation, // 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: 默认键盘,支持所有

UIKeyboardTypeASCIICapable: 支持ASCII的默认键盘

UIKeyboardTypeNumbersAndPunctuation: 数字键盘

UIKeyboardTypeURL: URL键盘,支持URL,有.com按钮

UIKeyboardTypeNumberPad: 数字键盘

UIKeyboardTypePhonePad: 电话键盘

UIKeyboardTypeNamePhonePad: 支持输入用户名字的电话键盘


UIKeyboardTypeEmailAddress: 邮箱键盘,主要用于输入邮箱地址

UIKeyboardTypeDecimalPad: 带小数点的键盘

UIKeyboardTypeTwitter: 具有@,#按钮

UIKeyboardTypeWebSearch:

UIKeyboardTypeASCIICapableNumberPad: 已经过期

UIKeyboardTypeAlphabet: 已经过期

使用:
password.keyboardtype = UIKeyboardTypeNumberPad;
2、键盘外观
typedef NS_ENUM(NSInteger, UIKeyboardAppearance) {UIKeyboardAppearanceDefault, // Default appearance for the current input method.UIKeyboardAppearanceDark API_AVAILABLE(ios(7.0)),UIKeyboardAppearanceLight API_AVAILABLE(ios(7.0)),UIKeyboardAppearanceAlert = UIKeyboardAppearanceDark, // Deprecated};
- UIKeyboardAppearanceDefault

- UIKeyboardAppearanceDark

- UIKeyboardAppearanceLight

- UIKeyboardAppearanceAlert
3、回车键
typedef NS_ENUM(NSInteger, UIReturnKeyType) {UIReturnKeyDefault,UIReturnKeyGo,UIReturnKeyGoogle,UIReturnKeyJoin,UIReturnKeyNext,UIReturnKeyRoute,UIReturnKeySearch,UIReturnKeySend,UIReturnKeyYahoo,UIReturnKeyDone,UIReturnKeyEmergencyCall,UIReturnKeyContinue API_AVAILABLE(ios(9.0)),};
| UIReturnKeyDefault | ![]() |
| UIReturnKeyGo | ![]() |
| UIReturnKeyGoogle | ![]() |
| UIReturnKeyJoin | ![]() |
| UIReturnKeyNext | ![]() |
| UIReturnKeyRoute | ![]() |
| UIReturnKeySearch | ![]() |
| UIReturnKeySend | ![]() |
| UIReturnKeyYahoo | ![]() |
| UIReturnKeyDone | ![]() |
| UIReturnKeyEmergencyCall | ![]() |
| UIReturnKeyContinue: 过期 | ![]() |
**self**.textView.returnKeyType = UIReturnKeyContinue;
4、自动大写
typedef NS_ENUM(NSInteger, UITextAutocapitalizationType) {
UITextAutocapitalizationTypeNone,
UITextAutocapitalizationTypeWords,
UITextAutocapitalizationTypeSentences,
UITextAutocapitalizationTypeAllCharacters,
};
// use
self.textView.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
- UITextAutocapitalizationTypeNone
- UITextAutocapitalizationTypeWords: 单词首字母大写
- UITextAutocapitalizationTypeSentences: 句子首字母大写
- UITextAutocapitalizationTypeAllCharacters: 所有字母大写
5、自动更正
typedef NS_ENUM(NSInteger, UITextAutocorrectionType) {
UITextAutocorrectionTypeDefault,
UITextAutocorrectionTypeNo,
UITextAutocorrectionTypeYes,
};
// 使用
password.autocorrectionType = UITextAutocorrectionTypeYes;
6、安全文本输入
extView.secureTextEntry=YES;












