UIPanGestureRecognizer inaccurate on iPhone 5s + iOS 7

Im using UIPanGestureRecognizer to pan in my game (cocos2d 2.0), it works fine from iOS 5.x to 6.x. Suddenly in iOS 7 it gets very volatile. You can roll for a while, but in the end it becomes inaccurate. Even before my game code does anything with a gesture, I clearly see in my magazines that the translation jumps 3-5 points. Usually smooth finger drag has a translation of only 1 point per change. Slipping near the edges of the screen appears to immediately cause a problem, but also causes it to pan.

Has anything changed that will cause problems with cocos2d? Or a gesture recognizer in general?

+4
source share
1 answer

Some priority seems to conflict with CADisplayLink updating the openGL view and the sendEvent UIApplication method. I struggled with this for a week! In my tests, I found that UIPanGestureRecognizer usually starts with every screen refresh while your finger moves. When you update GLKView (or whatever openGL context I assume), each so often the recognizer skips a few frames. If you plug in CADisplayLink to update GLKView and the pan, you can see it for yourself.

-(void)panRecCallback:(UIPanGestureRecognizer *)rec{
    CGPoint loc = [panRec locationInView:self.view];
    printf("    rec loc %3.3f %3.3f\n",loc.x,loc.y);
}
-(void)display:(CADisplayLink *)displayLink{
    [myGLKView display];
    CGPoint loc = [panRec locationInView:self.view];
    printf("display loc %3.3f %3.3f\n",loc.x,loc.y);
}

, . , , , openGL , , - , . , , . hack, _ , [glkView display], , , . , , , !

0

All Articles