Overriding sendEvent in custom UIApplication to detect hardware keyboard event

I am developing an iPad application that needs to read data from a hardware keyboard. The main user will be touching the screen normally, while the other user will control some aspects of the app from the adjacent Bluetooth keyboard that is paired with the iPad.

Overriding the keyCommands property in UIResponder works fine so far. But when we moved the application to Cocos2d (which uses its own responder chain) all keyCommands stopped working.

I tried to subclass UIApplication with the overridden sendEvent: method , something simple:

#import "MyUIApplication.h"

@implementation MyUIApplication  // subclass of UIApplication

-(void)sendEvent:(UIEvent *)event {
    [super sendEvent:event];
    NSLog(@"Event detected");
}

      

As far as I can tell, this successfully detects all events except hardware keyboard events, which seem to be completely ignored. Is there a way to detect these events without using keyCommands and UIKeyCommand s?

+3
ios uiapplication


source to share


No one has answered this question yet

Check out similar questions:

122
Hide keyboard on scrolling UITableView
7
External integration with Bluetooth keyboard in IOS 7
4
How to detect all touches in Swift 2
4
SDK safe way to hide iPad keyboard when text image is in focus
2
How to detect keyboard events on hardware keyboard on iPhone (iOS)
1
Change UILabel based on UIButton control events
1
iOS responds to physical keyboard events and UIInternalEvent
1
- (void) sendEvent method: (UIEvent *) for iPhone 5.0 events
1
Detecting touch events during device transition
0
How to detect device orientation change on iPad iOS 9+ when lock is set outside?



All Articles
Loading...
X
Show
Funny
Dev
Pics