Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting screen coordinates from UILongPressGestureRecognizer

I am trying to implement a UILongPressGestureRecognizer in an iOS app. It fires as expected, but I don't see anyway of passing screen coordinates to my target method. Does anyone know how to do this?

like image 533
serverpunk Avatar asked Jan 04 '12 04:01

serverpunk


1 Answers

This seems to work as an action:

- (void)receivedLongPress:(UIGestureRecognizer *)gestureRecognizer 
{
     CGPoint coords = [gestureRecognizer locationInView:gestureRecognizer.view];
}

I still don't really understand (it seems like the last touch point is stored in the gestureRecognizer, in which case I would expect there to just be a property or something). But hey, it works.

like image 143
serverpunk Avatar answered Nov 23 '22 19:11

serverpunk