Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable UITextField keyboard shortcut suggestions

Tags:

Is there a simple way to remove keyboard shortcut suggestions from a UITextField?

It is possible to remove typing correction with: [textField setAutocorrectionType:UITextAutocorrectionTypeNo]; however this as no effect on shortcuts.

Affecting the sharedMenuController also does not squash this.

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {     [UIMenuController sharedMenuController].menuVisible = NO;     return  NO; } 

enter image description here

like image 510
Matt Avatar asked Apr 03 '14 13:04

Matt


People also ask

How do I turn off keyboard suggestions in Swift?

You have to disable autocorrection on the text field/text/any other class that conforms to the UITextInputTraits protocol, which can be done through the autocorrectionType property.

How do you delete UITextField?

The standard clear button is displayed at the right side of the text field as a way for the user to remove text quickly. This button appears automatically based on the value set for this property.

Which delegate function removes keyboard in UITextField?

If you have a UITextField and you want to hide the keyboard when the user is pressing the return key, use the textFieldShouldReturn function. Be sure you have set the textField. delegate = self in your viewDidLoad() function.


1 Answers

Objective-C

textField.autocorrectionType = UITextAutocorrectionTypeNo; 

Swift

textField.autocorrectionType = .no 

Documentation https://developer.apple.com/library/ios/documentation/uikit/reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html

like image 102
Lepidopteron Avatar answered Oct 05 '22 01:10

Lepidopteron