【iOS】The motion stops when I start operating the view

Q. Model's motion stops when I start operating the view with iOS version.

A. This is because the timer's updating stops while scrolling other View.
When there is a table etc. in the foreground of the View which is a draw target of OpenGL, the updating of the OpenGL screen stops while scrolling it.
In this case, try to use NSTimer, not CADisplayLink.

- (void)startAnimation
{
    if (!animating)
    {
   animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationFrameInterval
                                    target:self 
                                    selector:@selector(drawView:) 
                                    userInfo:nil repeats:TRUE];

      // If the following line is added, the animation will not stop even while scrolling the other View.
      [[NSRunLoop currentRunLoop] addTimer:animationTimer forMode:NSRunLoopCommonModes];

        animating = TRUE;
    }
}












Comments