Last active
January 10, 2017 18:32
-
-
Save plam4u/c8d7ad78a8243f694359 to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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