Disable UITextField Predictive Text

后端 未结 6 1515
庸人自扰
庸人自扰 2020-12-08 06:06

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

相关标签:
6条回答
  • 2020-12-08 06:27

    like this you on or off UITextAutocorrectionType

    myTextView.autocorrectionType = UITextAutocorrectionTypeNo;
    myTextView.autocorrectionType = UITextAutocorrectionTypeYes;

    0 讨论(0)
  • 2020-12-08 06:35

    Setting autocorrectionType to .no allowed my tableview to scroll to the last entry. With predictive text on the last line was blocked from being selected.

    0 讨论(0)
  • 2020-12-08 06:41

    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
    
    0 讨论(0)
  • 2020-12-08 06:44

    FIXED for SWIFT-3:

    myTextField.autocorrectionType = .no
    
    0 讨论(0)
  • 2020-12-08 06:45

    The chosen answer is correct, but you also have an option to do the same in storyboard.

    All you need is to select your textfield, and under "show the Attributes inspector", set Correction to NO.

    See attached image

    0 讨论(0)
  • 2020-12-08 06:46

    Swift 2

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

    Swift 3

    textField.autocorrectionType = .yes
    textField.autocorrectionType = .no
    
    0 讨论(0)
提交回复
热议问题