With the availability of keyboards for iPads and iPhones, it makes sense to add keyboard shortcuts to apps now.
Is it possible to do this in an app? What are the relevant APIs?
While this question is fairly old, Apple has added support for keyboard specific shortcuts in iOS 7. Check out the UIKeyCommand class in the UIKit Framework for special support for hardware keyboard shortcuts. The high level steps for us are:
keyCommandWithInput:modifierFlags:action:
method on the UIKeyCommand
class to create an instance of the UIKeyCommand
for the specified keys with modifiers. Note that any keyboard shortcuts handled by the system (like Command-C for copy) will not work. You will also pass an action selector that will be called when the keyboard shortcut is usedUIKeyCommand
with your responder object(s) by returning them from the responder object's keyCommand
property. 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