Skip to content

Instantly share code, notes, and snippets.

@robmint
Created August 26, 2010 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robmint/552477 to your computer and use it in GitHub Desktop.
Save robmint/552477 to your computer and use it in GitHub Desktop.
get x and y from a UIEvent in iOS
- (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