Skip to content

Instantly share code, notes, and snippets.

@plam4u plam4u/DebugWithKeyboard.m
Last active Jan 10, 2017

Embed
What would you like to do?
Debugging via keyboard shortcuts.return array of UIKeyCommand objects, which define a keyboard shortcut.The ViewController will execute corresponding actions mapped to the shortcut.Useful when you want to simulate interactivity but the UI is not ready yet or when you just need to do some debug work.
- (BOOL)canBecomeFirstResponder
{
return YES;
}
-(NSArray *)keyCommands
{
return @[
[UIKeyCommand keyCommandWithInput:@"1" modifierFlags:0 action:@selector(debugCommand1)],
[UIKeyCommand keyCommandWithInput:@"2" modifierFlags:0 action:@selector(debugCommand2)]
];
}
-(void)debugCommand1
{
NSLog(@"debugCommand1");
}
-(void)debugCommand2
{
NSLog(@"debugCommand2");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.