Mik*_*imz 69 xcode uitextfield ios8
随着iOS 8的发布,我想在我开始在UITextField中输入时禁用键盘的预测文本部分.不知道如何做到这一点,任何帮助将不胜感激!
Mik*_*imz 159
将autoCorrectionType设置为UITextAutocorrectionTypeNo就可以了
Objective-C的
textField.autocorrectionType = UITextAutocorrectionTypeYes;
textField.autocorrectionType = UITextAutocorrectionTypeNo;
Run Code Online (Sandbox Code Playgroud)
斯威夫特2
textField.autocorrectionType = .Yes
textField.autocorrectionType = .No
Run Code Online (Sandbox Code Playgroud)
斯威夫特3
textField.autocorrectionType = .yes
textField.autocorrectionType = .no
Run Code Online (Sandbox Code Playgroud)
And*_*ndy 15
斯威夫特2
textField.autocorrectionType = .Yes
textField.autocorrectionType = .No
Run Code Online (Sandbox Code Playgroud)
斯威夫特3
textField.autocorrectionType = .yes
textField.autocorrectionType = .no
Run Code Online (Sandbox Code Playgroud)
Eri*_*ock 11
对我来说,它还可以将拼写检查类型设置为否(iOS 15,Swift 5+)
textField.autocorrectionType = .no
textField.spellCheckingType = .no
Run Code Online (Sandbox Code Playgroud)
像你这样开启或关闭UITextAutocorrectionType
myTextView.autocorrectionType = UITextAutocorrectionTypeNo;
myTextView.autocorrectionType = UITextAutocorrectionTypeYes;