问题
I know that since iOS 7 it is possible to capture keyboard shortcuts in apps using the UIKeyCommand class.
Is it possible to implement the command, alt, control, tab keys in a custom keyboard to fire some keyboard shortcuts like copy, paste or some custom shortcuts defined within each app?
Maybe there is a way to simulate the input from the external keyboard forcing something with UIKeyCommand?
回答1:
Nope. Custom keyboards (that is, onscreen keyboards from the iOS 8 keyboard extension API) insert text, they don't send key events. And inserting text is all they can do — the API for custom keyboards is very narrowly defined... presumably for privacy/security reasons.
I know I wouldn't want a keyboard extension randomly performing UI actions in other apps without my involvement. But Apple might think differently if you can provide a good use case in a feature request...
来源:https://stackoverflow.com/questions/28634523/command-alt-control-tab-keys-in-ios-8-custom-keyboard