Search code examples
iosipadkeyboard

How to hide the keyboard assistant bar


I'm working on an iPad app, and I am unable to hide the UIKeyboardAssistantBar, the bar shown above the soft keyboard, with text prediction etc. See picture below, which shows the full keyboard, just to give a reference - the bar I want to hide is above the keyboard (the one displaying "2")

Keyboard + assistant bar

The problem I have is when an external keyboard is used: the soft keyboard is not shown when a text view obtains the focus, but that assistant bar is always shown instead - the only way I've found so far is to let the user manually hide it, using the icon at the far right.

Ideally, the solution I'm looking for is a global call that enables or disables that, so that I don't have to handle that individually for each text view.

Any idea?


Solution

  • There is a trick that you can try. Here is the code:

    let item = self.yourTextView.inputAssistantItem;
    item.leadingBarButtonGroups = [];
    item.trailingBarButtonGroups = [];