UIScrollView中断并停止了使用OpenGL渲染的滚动(相关的CADisplayLink,NSRunLoop) [英] UIScrollView broken and halts scrolling with OpenGL rendering (related CADisplayLink, NSRunLoop)

查看:135
本文介绍了UIScrollView中断并停止了使用OpenGL渲染的滚动(相关的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆