New in iOS 9 on iPad, there's a toolbar (known as the Shortcut bar) placed above the keyboard that provides undo, redo, and paste buttons. It appears while using the system keyboard or third-party keyboards, but it doesn't appear above the emoji keyboard. I don't want this toolbar visible when my custom keyboard extension is in use, as my keyboard is similar to the emoji keyboard. (Note that I'm talking about a custom keyboard extension that can be used in any app, not the keyboard shown when a text field becomes first responder in your own app.) So how can one remove it?
You can remove it using this
- (void)textFieldDidBeginEditing:(UITextField*)textField
{
if(SYSTEM_VERSION_GREATER_THAN(@"8.4")){
UITextInputAssistantItem* item = [textField inputAssistantItem];
item.leadingBarButtonGroups = @[];
item.trailingBarButtonGroups = @[];
}
}
and of course you need to define the macro SYSTEM_VERSION_GREATER_THAN in header to check for the version since this code will crash your app on iOS 8
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
have fun :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With