Solution note, Not a question.
UIScrollView
suspends OpenGL rendering by preventing firing CADisplayLink
tick when CADisplayLink
registered with NSDefaultRunLoopMode
.
But, if you use NSRunLoopCommonModes
to solve this, UIScrollView
will halt scrolling at burst scrolling. And after once halted, it does not scroll again. (broken)
And registering CADisplayLink in other thread/runloop (as described in answer of this question: CADisplayLink stops updating when UIScrollView scrolled) reduces UIScrollView behavior breaking, but cannot eliminate.
Use
UITrackingRunLoopMode
. It's specifically designed for scrolling stuffs.Otherwise, call render & present code at
-scrollViewDidScroll
too, not only inCADisplayLink
's tick callback.This is also explained with a walk through in Apple's WWDC 2012, session 223: "Enhancing user experience with scroll views", second half: https://developer.apple.com/videos/wwdc/2012/.
Here you can find a better (and more complex) solution:
Animation in OpenGL ES view freezes when UIScrollView is dragged on iPhone
that allows you to use 'NSRunLoopCommonModes' and avoids OpenGL freezing when holding a finger without scrolling.
Edit: Woops, misread your post. Nevermind
As mentioned in this post, you can solve this issue by switching run loop modes. Animation in OpenGL ES view freezes when UIScrollView is dragged on iPhone