I subclassed the UIWindow, but for some reason the - (void)sendEvent:(UIEvent *)event gets called 2 times for any interaction with the screen. Any ideas why would that happen?
For debugging purposes, subclass window (of app delegate) and override sendEvent: method
-(void) sendEvent:(UIEvent *)event
{
NSLog(@"%@",event);
[super sendEvent:event];
}
Most probably, you will notice the events responsible for TouchesBegan and TouchesEnded (for tapping). This can be tested by subclassing the View and overriding touch related methods.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"tocuhesBegan");
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touchesMoved");
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touchesEnded");
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"touchesCancelled");
}
Also, try drag/swipe on the view to notice the change in count of events sent to view :)