关闭 textField、textView 的键盘联想和拼写检查

码上行动

self.textField.autocorrectionType = UITextAutocorrectionTypeNo; // 关闭键盘联想
self.textField.spellCheckingType = UITextSpellCheckingTypeNo;// 禁用拼写检查

对应的设置选项:

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

你可能感兴趣的:(关闭 textField、textView 的键盘联想和拼写检查)