Skip to content

Instantly share code, notes, and snippets.

@steventroughtonsmith
Last active April 2, 2019 01:38
Show Gist options
  • Save steventroughtonsmith/7515380 to your computer and use it in GitHub Desktop.
Save steventroughtonsmith/7515380 to your computer and use it in GitHub Desktop.
iOS 7 UIKeyCommand keydown/keyup and keycode input implementation for a UIResponder. Private API, of course…
-(BOOL)canBecomeFirstResponder
{
return YES;
}
-(UIKeyCommand *)_keyCommandForEvent:(UIEvent *)event // UIPhysicalKeyboardEvent
{
NSLog(@"keyCommandForEvent: %@\n\
type = %i\n\
keycode = %@\n\
keydown = %@\n\n",
event.debugDescription,
event.type,
[event valueForKey:@"_keyCode"],
[event valueForKey:@"_isKeyDown"]);
return [UIKeyCommand keyCommandWithInput:nil modifierFlags:nil action:@selector(processKeyInput:)];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment