+ (NSTimer*)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullable id)userInfo repeats:(BOOL)yesOrNo;
Initializes a timer object with the specified object and selector.
You must add the new timer to a run loop, using?addTimer: forMode:. Then, after ti seconds have elapsed, the timer fires, sending the message aSelector to target. (If the timer is configured to repeat, there is no need to subsequently re-add the timer to the run loop.)
你必須把新創(chuàng)建的定時(shí)器添加到一個(gè)runloop中,然后定時(shí)器才會(huì)真正啟動(dòng)。
+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullable id)userInfo repeats:(BOOL)yesOrNo;
Creates a timer and schedules it on the current run loop in the default mode.
After ti seconds have elapsed, the timer fires, sending the message aSelector to target.
這個(gè)方法創(chuàng)建一個(gè)定時(shí)器,以default模式添加到當(dāng)前的runloop中,相當(dāng)于做了兩步。