read

Add the next method to code:

<pre class="default prettyprint" style="background-color: #eeeeee; border-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;">-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
   
UITouch *touch = [[event allTouches] anyObject];
   
CGPoint location = [touch locationInView:touch.view];
   
NSLog(@"X: %f",location.x);//Print values for debug
   
NSLog(@"Y: %f",location.y);
}
</pre>Now location.x and location.y you have the absolute touch point

Source


Blog Logo

Daniel Gomez Rico


Published

Image

MakinGIANTS

The findings and tips records of an Android-iOS-TheWholeShabang group

Back to Overview