iphone定时器方法
?
Creates and returns a new? The number of seconds between firings of the timer. If?seconds?is less than or equal to? The object to which to send the message specified by?aSelector?when the timer fires. The target object is retained by the timer and released when the timer is invalidated. The message to send to?target?when the timer fires. The selector must have the following signature: The timer passes itself as the argument to this method. The user info for the timer. The object you specify is retained by the timer and released when the timer is invalidated. This parameter may be? If? A new? After?seconds?seconds have elapsed, the timer fires, sending the messageaSelector?to?target.scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:
NSTimer
?object and schedules it on the current run loop in the default mode.Parameters
0.0
, this method chooses the nonnegative value of 0.1 milliseconds instead.- (void)timerFireMethod:(NSTimer*)theTimer
nil
.YES
, the timer will repeatedly reschedule itself until invalidated. If?NO
, the timer will be invalidated after it fires.Return Value
NSTimer
?object, configured according to the specified parameters.Discussion
?
定义定时器例子:
?
NSTimer *timer=[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(showTime) userInfo:nil repeats:YES];?
?
?
结束定时器例子:
[timer invalidate];?
?
?