You will have to subclass UIWindow with your own class and override the sendEvent: method. But remember that the method receives other types of events - not only concerns, so you need to check the type of event ( event.type == UIEventTypeTouches ). In addition, since you get a set of touches, you can check which of them have just begun, which of them have ended, moved, etc. To do this, you need to iterate through allTouches and check the phase property for each UITouch .
@implementation TouchWindow - (void)sendEvent:(UIEvent *)event { if (event.type == UIEventTypeTouches) { for(UITouch * t in [event allTouches]) { if(t.phase == UITouchPhaseBegan) { } } } [super sendEvent:event]; } @end
Of course, TouchWindow is a subclass of UIWindow
@interface TouchWindow : UIWindow @end
And you probably have to change this class in the .xib file in Xcode
shw
source share