关闭 textfield、textview 的键盘联想和拼写检查

1
2
self.textField.autocorrectionType = UITextAutocorrectionTypeNo; 
self.textField.spellCheckingType = UITextSpellCheckingTypeNo;// 禁用拼写检查

对应的设置选项:

1
2
3
4
5
typedef NS_ENUM(NSInteger, UITextAutocorrectionType) {
UITextAutocorrectionTypeDefault, //默认
UITextAutocorrectionTypeNo, //不自动纠错
UITextAutocorrectionTypeYes, //自动纠错
};
1
2
3
4
5
typedef NS_ENUM(NSInteger, UITextSpellCheckingType) {
UITextSpellCheckingTypeDefault, // 默认
UITextSpellCheckingTypeNo, // 禁用联想
UITextSpellCheckingTypeYes, // 使用联想
} NS_ENUM_AVAILABLE_IOS(5_0);