NSTimer stops during scrolling

2019-02-10 23:54发布

问题:

During debugging my IOS project developed in XCode4, I initialize and run an NSTimer object. However, the timer stops as soon as I press the scroll view and it continues to run after I release the scroll.

Is there a configuration for NSTimer such that timer is not blocked during scrolling?

Thanks in advance.

回答1:

Add this single line and try again please

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