Search code examples
ioskeyboardbluetootharrow-keys

Within an iOS app how do I detect that the user has pressed one of the arrow keys on their external keyboard?


I have a couple of iOS applications which present inherently linearly organised information, allowing the user to move forward and backward through the data with on-screen controls. I would like to allow users with the keyboard dock or a paired bluetooth keyboard to use the arrow keys to move back and forth as well. Since the apps are full-screen it is very important to the user experience that there is no risk of displaying an on-screen keyboard as a side-effect.

I cannot find an API that will let me do this in Apple's documentation; but I cannot be sure that I have used the right search terms.

What APIs are there which will allow me to achieve this?

Update: I have raised this as an enhancement on Apple's bug reporting site.


Solution

  • Not actually knowing, I suspect the answer is "you can't, not in an official way".

    Since a user-friendly UI is top priority for the iPad platform according to Apple, I think they are doing what they can to discourage behavior that would depend on a keyboard being available. Apps should behave the same and provide the same functionality with or without a hardware keyboard. Things like keyboard hotkeys or navigation that doesn't use on-screen elements are probably no-no:s for that reason.

    But, like I said, this is just speculation.