Hide toolbar above custom keyboard extension in iOS 9

New to iOS 9 on the iPad, there is a toolbar (known as a quick access toolbar) located above the keyboard that provides cancel, redo, and paste buttons. It appears when using the system keyboard or third-party keyboards, but does not appear above the emoji keyboard. I do not want this toolbar to be visible when using my keyboard extension , as my keyboard is similar to an emoji keyboard. (Note that I'm talking about a custom keyboard extension that can be used in any application, not the keyboard, when the text field becomes the first responder in your own application.) So how can it be deleted?

+6
source share
1 answer

You can delete 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 SYSTEM_VERSION_GREATER_THAN macro in the header to check the version, as this code will crash your application in iOS 8

 #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) 

enjoy:)

+7
source

All Articles