Search code examples
iosgestureretina-display

GestureRecognizer on retina screen


The pixel number of each side of retina Device is double of non-retina device. When using UIPanGestureRecognizer,i can get velocity of the pan in pixels/second in the coordinate system of the specified view by calling - (CGPoint)velocityInView:(UIView *)view,but do I need divide the return value by 2 to get a correct velocity?I have read the document from apple,developer do not take care the x2 problem.But the comment in UIPanGestureRecognizer.h make me confuse.


Solution

  • No, it returns it in points per second, that is not pixels per second.

    Apple chose for points as a unit because it is not dependent on the pixel densitiy of the screen. Meaning that the 3G and the iPhone 4 have the exact same result with this gesture recognizer. The iPhone5 has a bigger screen but that doesn't change anything you have to do with what the recognizer returns.

    Thus to your answer: No, you should not divide it by 2, apple is taking care in their API's.