UIScrollView pauses NSTimer until scrolling finishes

mcccclean picture mcccclean · Mar 3, 2009 · Viewed 17.3k times · Source

While a UIScrollView (or a derived class thereof) is scrolling, it seems like all the NSTimers that are running get paused until the scroll is finished.

Is there a way to get around this? Threads? A priority setting? Anything?

Answer

Kashif Hisam picture Kashif Hisam · Apr 30, 2010

An easy & simple to implement solution is to do:

NSTimer *timer = [NSTimer timerWithTimeInterval:... 
                                         target:...
                                       selector:....
                                       userInfo:...
                                        repeats:...];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];