Matt Matt - 3 months ago 31
iOS Question

Disable UITextField keyboard shortcut suggestions

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


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


Solved this by implementing a UITextFieldDelegate method and manually setting the text property of UITextField.

By default in the simulator you can test this behaviour by typing "omw" which should suggest "On my way!". The following code will block this. Note: this does also disable auto-correction and check spelling which was ok in my case.

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    // Pass through backspace and character input
    if (range.length > 0 && [string isEqualToString:@""]) {
        textField.text = [textField.text substringToIndex:textField.text.length-1];
    } else {
        textField.text = [textField.text stringByAppendingString:string];
    // Return NO to override default UITextField behaviors
    return NO;