NSTimer只执行一次的问题

今天犯的问题太二了,oop

NSTimer spa

应该使用 get

+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo;it

结果错用成了class

+ (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo;select

fire以后,结果发现程序只执行了一次。bug

太囧了,害我花了20分钟看bug。程序

 

timer本质是须要加入到runloop中的,这也是形成使用后者只执行一次的缘由。im

 

信心点,谨记。loop

相关文章
相关标签/搜索