I'm trying to capture all the touch events in a UIKeyboard without breaking its functionality. I've tried:
- HitTest:
- UIGestureRecognizer
- Adding a UIWindow in the top and pass events to next responder
However, none of these worked.
And it seems that we aren't allowed to sub class the UIKeyboard.
Can you think of any method that may work?
Thanks,
Peak
Update:
Lets simplify the problem: How can I add a UIView or UIWindow that passes specific touch events to the next responder(just like setting the userInteractionEnabled to NO)?
Heres my code(of course can't work...):
- (void)sendEvent:(UIEvent *)event {
NSLog(@"%@",event);
//if ([self eventIsNoteworthy:event]) [self extraEventHandling:event];
[super sendEvent:event]; // Apple says you must always call this!
}
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
CGPoint hitPoint = [underneathButton convertPoint:point fromView:self];
if ([underneathButton pointInside:hitPoint withEvent:event]) return underneathButton;
NSLog(@"Called");
return [super hitTest:point withEvent:event];
//return mainWindow;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
NSLog(@"Start");
[self.nextResponder touchesBegan:touches withEvent:event];
}