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(如本问题的回答所述:CADisplayLink 在 UIScrollView 滚动时停止更新) 减少 UIScrollView 行为中断,但无法消除.
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.
推荐答案
使用UITrackingRunLoopMode
.它专为滚动内容而设计.
Use UITrackingRunLoopMode
. It's specifically designed for scrolling stuffs.
否则,调用 render &也可以在 -scrollViewDidScroll
中显示代码,而不仅仅是在 CADisplayLink
的刻度回调中.
Otherwise, call render & present code at -scrollViewDidScroll
too, not only in CADisplayLink
's tick callback.
这篇关于UIScrollView 损坏并停止使用 OpenGL 渲染滚动(相关 CADisplayLink、NSRunLoop)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!