有時候,我們在使用UIScrollView時,程序中加入了View動畫,且使用了NSTimer來更新動畫,這個時候,我們要注意了,當滑動UIScrollView時,你會發現動畫暫停了,這是因爲NSTimer被暫停了,解決方法是:
NSTimer * activeTimer=[NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(staticUpdateTime)
userInfo:nil
repeats:YES];
NSRunLoop * main=[NSRunLoop currentRunLoop];
[main addTimer:activeTimer forMode:NSRunLoopCommonModes];
注意紅色部分的字,添加上這兩行就行了。
原因可以訪問該地址:http://www.cnblogs.com/v2m_/archive/2013/01/06/2846984.html