Can I get the iOS Simulator to listen for keyboard events for debugging purposes?

What I want to do is do a keyboard shortcut for debugging on the iOS simulator. for example Right arrow key to invoke acceleration function to speed up the game. Note that the soft keyboard is off when I press the debug keys.


source to share

2 answers

The only easy way to achieve this (which I can think of) is to create some very small buttons in your application and wire them to the functions you want to call. You can place them somewhere where they don't interfere with the user interface. Since you are developing for a mobile device, unfortunately you cannot press a key on your keyboard and call a function.



Deselect the property keyCommands

to enable keyboard shortcuts. This property is on UIResponder

, so it can be done in any of your views, view controllers, or even your application's delegation.



All Articles