Created
August 7, 2012 18:42
Revisions
-
David Fox revised this gist
Aug 8, 2012 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,9 +15,7 @@ +(void) load -(void) interceptAndSendEvent: (UIEvent *) event { for (UITouch *touch in event.allTouches){ if (touch.phase == UITouchPhaseBegan){ [EventLogger logEvent:EVENT_LOGGER_TOUCHED forObject:touch.view]; } } -
David Fox revised this gist
Aug 8, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ +(void) load -(void) interceptAndSendEvent: (UIEvent *) event { for (UITouch *touch in event.allTouches){ if ([touch.view isKindOfClass:[UIResponder class]] && touch.phase == UITouchPhaseBegan){ [EventLogger logEvent:EVENT_LOGGER_TOUCHED forObject:touch.view]; -
David Fox created this gist
Aug 7, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #import "UIApplication+EventInterceptor.h" #import <objc/runtime.h> #import "EventLogger.h" @implementation UIApplication (EventInterceptor) +(void) load { //Swap the implementations of our interceptor and the original sendEvent: Method oldMethod = class_getInstanceMethod(self, @selector(sendEvent:)); Method newMethod = class_getInstanceMethod(self, @selector(interceptAndSendEvent:)); method_exchangeImplementations(oldMethod, newMethod); } -(void) interceptAndSendEvent: (UIEvent *) event { for (UITouch *touch in event.allTouches){ if ([touch.view isKindOfClass:[UIView class]] && touch.phase == UITouchPhaseBegan){ [EventLogger logEvent:EVENT_LOGGER_TOUCHED forObject:touch.view]; } } [self interceptAndSendEvent:event]; }