Disable Keyboard Shortcut Bar?

Has anyone found a way to programatically disable the cut/copy/paste shortcut bar that appears over the keyboard on iPad? I have an financial app where input is strictly controlled via a custom numeric input controller and cut/copy/paste are not allowed. Thusly having the shortcut bar up there will be a bit confusing to the users since it won't function at all.


I've glanced through the documentation and searched the developer forums and can't seem to locate anything so any assistance would be appreciated!

Replies

As of iOS 9 beta 2, the documentation is still very thin on the ground (and vaguely misleading) but I've had success using this UITextFieldDelegate method implementation.


- (void)textFieldDidBeginEditing:(UITextField*)textField
{
    UITextInputAssistantItem* item = [textField inputAssistantItem];
    item.leadingBarButtonGroups = @[];
    item.trailingBarButtonGroups = @[];
}

It works on UiSearchBar Also

-(void) searchBarTextDidBeginEditing:(nonnull UISearchBar *)searchBar

{

UITextInputAssistantItem* item = [searchBar inputAssistantItem];

item.leadingBarButtonGroups = @[];

item.trailingBarButtonGroups = @[];

}

Thank you! Is there a way to reset / toggle the bar, so recovering the items which are being removed?

Did not work in iOS 9 beta 3, an empty bar is shown. Any other ideas?

I'd also like to know how to remove the bar

I'd like to remove the bar completely for now, has anyone figured out a way to do this?

This works for me on beta6. Is it still not working for you? You might need to turn off predictive text since it uses the same bar by setting

autocorrectionType
to
UITextAutocorrectionTypeNo.

iOS 16, Swift 5.7

override func viewDidLoad() {
    super.viewDidLoad()

    textField.inputAssistantItem.leadingBarButtonGroups = []
    textField.inputAssistantItem.trailingBarButtonGroups = []
}