I have the following code:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)recognizer shouldReceiveTouch:(UITouch *)touch {
NSLog(@"%@", NSStringFromCGPoint([recognizer locationInView:self.view]));
...
Every time I tap, however, I get {0, -64}
. No matter where I tap. What am I doing wrong?
I think this is the expected behavior because, "This method is called before touchesBegan:withEvent: is called on the gesture recognizer for a new touch". So, I think this means the recognizer won't know about its location yet. To get the location, use the touch argument provided instead:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)recognizer shouldReceiveTouch:(UITouch *)touch {
NSLog(@"%@", NSStringFromCGPoint([touch locationInView:self.view]));
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With