Question

Hey, been trying to get the location of a users swipe so that I can have 3 swipe-able areas on screen and determine which section they react with based on the y coordinates of their swipe.

This is the code

CGPoint touchPoint = [recognizer locationOfTouch:0 inView:nil];

I have tried printing the touchPoint.y in a label and all i get is 0. How do I get the coordinates of the users swipe?

Thanks.

Was it helpful?

Solution

Its strange but setting view as nil or self.view.window is returning 0. There is no mention of such behavior and Apple doc on UISwipeGestureRecognizer seems to encourage finding the origin of the swipe using this method. It would be a good idea to file this under a bug.

This is working for other views though. Say self.view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top