美文网首页
以+scheduledTimerWithTimeInterval

以+scheduledTimerWithTimeInterval

作者: 一块儿钱 | 来源:发表于2016-04-23 11:42 被阅读250次

解答:

RunLoop只能运行在一种mode下,如果要换mode,当前的loop也需要重启成新的。
利用这个机制,ScrollView滚动过程中NSDefaultRunLoopMode(kCFRunLoopDefaultMode)
的mode会却换到UITrackingRunLoopMode来保证ScrollView的流畅晃动:
只能在NSDefaultRunLoopMode模式下处理的事件会相应ScrollView的滑动
如果我们在一个NSTimer对象以NSDefaultRunLoopMode(KCFRunLoopDefaultMode)添加到住运行循环中的时候。
ScrollView滚动过程中会因为mode的切换。而导致NSTimer将不再被调度。

转载自《猿圈》
</br>
</br>

[专注待办](https://itunes.apple.com/cn/app/zhuan-zhu-dai-ban-ding-shi/id1103227570?mt=8)

相关文章

网友评论

      本文标题:以+scheduledTimerWithTimeInterval

      本文链接:https://www.haomeiwen.com/subject/ldgxrttx.html