I\'m trying to figure out how to detect that the Escape (and other key combinations like Ctrl and alt) have been pressed on a bluetooth keyboard attached to an iOS device.
You can do this now in iOS 7. For example, to implement the escape key, override UITextView and place the following methods in your class:
- (NSArray *) keyCommands {
UIKeyCommand *esc = [UIKeyCommand keyCommandWithInput: UIKeyInputEscape modifierFlags: 0 action: @selector(esc:)];
return [[NSArray alloc] initWithObjects: esc, nil];
}
- (void) esc: (UIKeyCommand *) keyCommand {
// Your custom code goes here.
}
You don't need to check to be sure you are on iOS 7, since earlier versions of the OS won't call the keyCommands method.