UIScrollView中断并停止了使用OpenGL渲染的滚动(相关的CADisplayLink,NSRunLoop) [英] UIScrollView broken and halts scrolling with OpenGL rendering (related CADisplayLink, NSRunLoop)
问题描述
解决方案说明,不是问题.
Solution note, Not a question.
UIScrollView
通过在CADisplayLink
注册到NSDefaultRunLoopMode
时阻止触发CADisplayLink
滴答声来挂起OpenGL渲染.
UIScrollView
suspends OpenGL rendering by preventing firing CADisplayLink
tick when CADisplayLink
registered with NSDefaultRunLoopMode
.
但是,如果使用NSRunLoopCommonModes
解决此问题,则UIScrollView
将在突发滚动时停止滚动.并且一旦停止,它就不会再次滚动. (断)
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)
并在其他线程/运行循环中注册CADisplayLink(如此问题的答案中所述:
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.
否则,请调用render&在-scrollViewDidScroll
处也显示代码,不仅在CADisplayLink
的tick回调中.
Otherwise, call render & present code at -scrollViewDidScroll
too, not only in CADisplayLink
's tick callback.
这篇关于UIScrollView中断并停止了使用OpenGL渲染的滚动(相关的CADisplayLink,NSRunLoop)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!