I support keyboard shortcuts in my iOS app through serving UIKeyCommand
instances from my view controller.
The following works like a charm and causes the provided selector to be invoked every time you press e:
- (BOOL)canBecomeFirstResponder {
return YES;
}
- (NSArray *)keyCommands {
return @[
[UIKeyCommand keyCommandWithInput:@"e" modifierFlags:0 action:@selector(foo:)]];
];
}
However, I want the key command to be ⌘+e, or
[UIKeyCommand keyCommandWithInput:@"e" modifierFlags:UIKeyModifierCommand action:@selector(foo:)]
This still works, kind of. It won't work the first time you press ⌘+e, but it will work like a charm after that. Why does that happen and how can I fix it?