I have some key commands registered in Responder chain on IOS application that reacts to F1-F12 keys. I have bluetooth keyboard connected to ipad that has some default functions assigned to most of F keys and because of that my application doesn't react when i click F key and fires the default behaviour.
For example i have callback registered on F1 key that has default function of dimming the screen. When i click F1 key the screen is dimmed and the callback is not fired.
When i click on F5 which does not have any default function the callback is called properly.
How can i disable this default behaviour or somehow make my application react to FKeys?
Keyboard model: A1644
Ipad 6
Post
Replies
Boosts
Views
Activity
@interface CallbackClass : NSObject
(void) doSomething:(UIKeyCommand*)keycmd;
(UIKeyCommand*) returnKeyCommand;
@end
@implementation CallbackClass
(void) doSomething:(UIKeyCommand*)keycmd {
NSLog(@"KEY CLICKED");
}
-(UIKeyCommand*) returnKeyCommand {
return [UIKeyCommand keyCommandWithInput:@"a"
modifierFlags:0
action:@selector(doSomething:)];
}
@end
void CppClass::bindKeyCommand() {
CallbackClass* callbackClass = [[CallbackClass alloc] init];
[[UIApplication sharedApplication].keyWindow.rootViewController]
addKeyCommand:[callbackClass returnKeyCommand]];
}
This is objective-c code that is injected into QT application with C++ and Cmake.
Responder chain after executing this code:
Even if this key command is present is in the responder chain i dont have any reaction on click on magic keyboard. When i do this in the pure objective-c but not with with QT, C++, Cmake project.
I Detect key input but only when i add my custom view controller do the subview of QIOSViewController, but then i cany click anything else on my application then.
I want to be able to detect key input or somehow inject a responder into responder chain and still being able to click things on my application.