Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable UITextField Predictive Text

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!

like image 779
Mike Simz Avatar asked Sep 10 '14 14:09

Mike Simz


People also ask

How do I turn off autocorrect in TextField?

TextField by default auto corrects values entered by users according to their locale but if you need to disable this feature then use disableAutocorrection modifier for that purpose.

What is UITextField?

An object that displays an editable text area in your interface.


2 Answers

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 

SwiftUI

textField.disableAutocorrection(true) textField.disableAutocorrection(false) 
like image 104
Mike Simz Avatar answered Oct 07 '22 13:10

Mike Simz


Swift 2

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

Swift 3

textField.autocorrectionType = .yes textField.autocorrectionType = .no 
like image 38
Andrew Avatar answered Oct 07 '22 13:10

Andrew