首页 > 移动平台 > 详细

iOS: UIScrollView pauses NSTimer while scrolling

时间:2014-07-07 22:02:34      阅读:382      评论:0      收藏:0      [点我收藏+]

StackOverflow http://stackoverflow.com/a/7059499

 

Question:I have a UIScrollView that has a series of labels which are rapidly updating numbers (every .06 seconds). While the scroll view is moving, however, the NSTimer is paused and does not continue until after the scrolling and the elastic animation have finished.

How can I avoid this and have the NSTimer run regardless of the state of the scroll view?

 

Anwser:An easy way to fix this is adding your NSTimer to the mainRunLoop.

[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];

To remove a timer from all run loop modes on which it is installed, send an invalidate message to the timer.

iOS: UIScrollView pauses NSTimer while scrolling,布布扣,bubuko.com

iOS: UIScrollView pauses NSTimer while scrolling

原文:http://www.cnblogs.com/ihojin/p/scrollview-timer-pause.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!