Created
August 26, 2010 23:39
-
-
Save robmint/552477 to your computer and use it in GitHub Desktop.
get x and y from a UIEvent in iOS
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 { | |
// touches is a NSSet - we get the first in the set | |
UITouch *touch = [touches anyObject]; | |
CGPoint touchPoint = [touch locationInView:self]; | |
NSLog(@"x=%f y=%f",touchPoint.x, touchPoint.y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment