UIScrollView broken and halts scrolling with OpenGL rendering (related CADisplayLink, NSRunLoop)

你说的曾经没有我的故事 提交于 2019-11-30 22:54:36
Josh Rosen

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

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/.

Ricardo Sanchez-Saez

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.

Use UITrackingRunLoopMode. It's specifically designed for scrolling stuffs.

Otherwise, call render & present code at -scrollViewDidScroll too, not only in CADisplayLink's tick callback.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!