Created
November 22, 2012 05:38
-
-
Save ishida/4129569 to your computer and use it in GitHub Desktop.
Detect touches
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
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
UITouch *touch = [touches anyObject]; | |
CGPoint p = [touch locationInView:aView]; | |
NSLog(@"Touch detected: x=%lf, y=%lf", p.x, p.y); | |
if (0 <= p.y && p.y <= aView.frame.size.height | |
&& 0 <= p.x && p.x <= aView.frame.size.width) | |
{ | |
//do something | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment