views:

576

answers:

1

I have a UIView that has a UIPanGestureRecognizer attached to it the gesture is working fine except that the starting point is not where the pan first started it is usually off by 5 to 15 pixels in both the x and y coordinates.Unfortunately the variance is not consistent and seems to be related to the speed at which the panning motion takes place.

To validate that the touches are being sent correctly I have added a touchesBegan method to a subview and it receives the correct starting point but the gesture does not provide the same point in it's begin phase. Some examples from my logs are below 'Line start point' is the first point received from the gesture recognizer.

touchesBegan got point 617.000000x505.000000
Line start point at 630.000000x504.0000001
touchesBegan got point 403.000000x503.000000
Line start point at 413.000000x504.000000 
touchesBegan got point 323.000000x562.000000
Line start point at 341.000000x568.000000

Has anyone seen this issue before?

Any ideas on how to work around the issue with out having to implement an entirely new UIGestureRecognizer?

+1  A: 

The documentation says that the pan gesture starts when the fingers have "moved enough to be considered a pan." This movement is to distinguish a press from a drag, since the user's finger could move around a bit while they are trying to press without dragging.

I think this is the difference you're seeing between the first touch point and the first point considered part of the drag.

Douglas
The problem occurs even if you create your own gesture recognizer by extending UIGestureRecognizer, the starting point is different than the touchesBegan methods. I submitted a bug to apple.
Cory Powers
Hmm, I'm not sure I understand. If you're implementing your own UIGestureRecognizer, wouldn't you define your own starting point in touchesBegan anyway?
Douglas