答案 0 :(得分:8)
将此代码放在 viewDidLoad
中yourTextFieldName.autocorrectionType = UITextAutocorrectionTypeNo;
UITextInputAssistantItem* shortcut = [yourTextFieldName inputAssistantItem];
shortcut.leadingBarButtonGroups = @[];
shortcut.trailingBarButtonGroups = @[];
<强>夫特强>
yourTextFieldName.autocorrectionType = .No
let shortcut : UITextInputAssistantItem = yourTextFieldName.inputAssistantItem
shortcut.leadingBarButtonGroups = []
shortcut.trailingBarButtonGroups = []
<强> swift3 强>
yourTextFieldName.autocorrectionType = .no
var shortcut: UITextInputAssistantItem? = yourTextFieldName.inputAssistantItem()
shortcut?.leadingBarButtonGroups = []
shortcut?.trailingBarButtonGroups = []
for reference
答案 1 :(得分:1)
How to hide the shortcut bar in iOS9
你试过这个吗?你所做的只是禁用文本提议,而不是撤消/重做/粘贴...东西。
答案 2 :(得分:0)
要完全隐藏快捷方式,请将leadingBarButtonGroups和trailingBarButtonGroups属性设置为nil。这样做只隐藏快捷方式,不会隐藏输入建议。要隐藏输入建议,还必须将显示键盘的响应者的autocorrectionType属性设置为UITextAutocorrectionTypeNo。
<editorView>.autocorrectionType = UITextAutocorrectionTypeNo;
UITextInputAssistantItem* shortcut = [<editorView> inputAssistantItem];
shortcut.leadingBarButtonGroups = @[];
shortcut.trailingBarButtonGroups = @[];