NSTimer

Define NSTimer in header file, so you can handle it if you need

NSTimer *timer;


// Creating a timer that call repeatJob every 1.0 sec

timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(repeatJob) userInfo:nil repeats:YES];



//killing timer

if([timer isValid]){

[timer invalidate];

timer = nil;

}



//there is no pause and play function for NSTimer, you should kill and recreate it


No comments:

Post a Comment