Disable UITextField Predictive Text

Mike Simz picture Mike Simz · Sep 10, 2014 · Viewed 48.1k times · Source

With the release of iOS 8 I would like to disable the predictive text section of the keyboard when I begin typing in a UITextField. Not sure how this is done, any help would be appreciated!

Answer

Mike Simz picture Mike Simz · Sep 10, 2014

Setting the autoCorrectionType to UITextAutocorrectionTypeNo did the trick

Objective-C

textField.autocorrectionType = UITextAutocorrectionTypeYes;
textField.autocorrectionType = UITextAutocorrectionTypeNo;

Swift 2

textField.autocorrectionType = .Yes
textField.autocorrectionType = .No

Swift 3

textField.autocorrectionType = .yes
textField.autocorrectionType = .no