Created
July 18, 2009 16:55
-
-
Save kishikawakatsumi/149615 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#import "UIViewTouch.h" | |
#import <MapKit/MapKit.h> | |
@implementation UIViewTouch | |
@synthesize viewTouched; | |
//The basic idea here is to intercept the view which is sent back as the firstresponder in hitTest. | |
//We keep it preciously in the property viewTouched and we return our view as the firstresponder. | |
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { | |
NSLog(@"Hit Test"); | |
viewTouched = [super hitTest:point withEvent:event]; | |
return self; | |
} | |
//Then, when an event is fired, we log this one and then send it back to the viewTouched we kept, and voilà!!! :) | |
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSLog(@"Touch Began"); | |
[viewTouched touchesBegan:touches withEvent:event]; | |
} | |
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSLog(@"Touch Moved"); | |
[viewTouched touchesMoved:touches withEvent:event]; | |
} | |
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSLog(@"Touch Ended"); | |
[viewTouched touchesEnded:touches withEvent:event]; | |
} | |
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSLog(@"Touch Cancelled"); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment