Antonio Antonio -4 years ago 132
iOS Question

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?

Answer Source

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

let item = self.yourTextView.inputAssistantItem;
item.leadingBarButtonGroups = [];
item.trailingBarButtonGroups = [];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download