禁用UITextField预测文本

禁用UITextField预测文本

本文介绍了禁用UITextField预测文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着iOS 8的发布,我想在开始输入UITextField时禁用键盘的预测文本部分。不知道如何做到这一点,任何帮助将不胜感激!

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!

推荐答案

将autoCorrectionType设置为UITextAutocorrectionTypeNo做了伎俩

Setting the autoCorrectionType to UITextAutocorrectionTypeNo did the trick

Objective-C

Objective-C

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

Swift 2

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

Swift 3

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

这篇关于禁用UITextField预测文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 02:28