Skip to content

Instantly share code, notes, and snippets.

@robmint
robmint / get x and y from a UIEvent in iOS
Created August 26, 2010 23:39
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);
}