Search code examples
iosopengl-essparrow-framework

SPTween freezes when dragging/zooming a view inside UIScrollView


I am using Sparrow framework. I have been playing with moving sprites around using SPTween and SXParticleSystem. The problem is when I move or resize a view inside UIScrollView, those tween and particles just freeze. When I end dragging, the sprite moves again, not from where it froze but they move from where they should be if it weren't frozen. How can animate those sprites along side with other animating UIKit elements.

I did try to use CoreAnimation (UIView animation) and drag the scrollview. It doesn't freeze. Any ideas?

CADisplayLink OpenGL rendering breaks UIScrollView behaviour

Animation in OpenGL ES view freezes when UIScrollView is dragged on iPhone

I have seen these similar post above and they suggest that the moving the scrollview changes the runLoopMode to one that OpenGL doesn't normally use. But I still don't know how to change the runLoops in Sparrow framework.

enter image description here

View full size


Solution

  • Solution found. In SPView.m line , change NSDefaultRunLoopMode to NSRunLoopCommonModes. The reason is the default OpenGL rendering in Sparrow is registered using NSDefaultRunLoopMode, which that mode will stop running in some circumstances such as a UI update. For more info, please read the link below.

    What are runloops and what modes can we use? https://stackoverflow.com/a/7223765/467588