IOS 完全删除自动更正栏

标签 ios xcode

有没有办法完全删除自动更正栏?

enter image description here

我已经设置:

textField.autocorrectionType = UITextAutocorrectionTypeNo;

但它不会删除栏,只是自动更正。

最佳答案

如果设置 auto CorrectionType 并删除 inputAssistantItem.leadingBarButtonGroupsinputAssistantItem.trailingBarButtonGroups,则可以隐藏此栏

self.textField.inputAssistantItem.leadingBarButtonGroups = []
    self.textField.inputAssistantItem.trailingBarButtonGroups = []
    self.textField.autocorrectionType =  .no

来自UITextInputAssistantItem文档

"

To hide shortcuts altogether, set the leadingBarButtonGroups and trailingBarButtonGroups properties to nil. Doing so hides only the shortcuts and does not hide the typing suggestions. To hide typing suggestions, you must also set the autocorrectionType property of the responder that displays the keyboard to UITextAutocorrectionType.no.

"

关于IOS 完全删除自动更正栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54992958/

相关文章:

iOS 8 屏幕旋转扰乱 View

ios - 无法在 iOS 11 GM 中更改多个文本字段颜色

ios - Xcode UITabBarController : Make Two tabs point to same ViewController

ios - 使用单元格按钮操作传递多个参数

ios - 用于移动聊天应用程序的 Socket.io 与 xmpp

ios - 在 NSDictionary 中格式化 JSON 数据

ios - 截图 UIImageView 和 UILabel 然后分享

ios - CocoaPods:如何设置 pod 的路径

iphone - 如何创建 slider ?

swift - NoOptionalInterpolation Pod 错误 Swift