How can I call the method automatically 20 times per second?

From JavaScript I am using to create an interval and specify a delay to call the function again until I stop the interval. Is there something similar on the iPhone? Any good links are highly appreciated. This applies to the community wiki.

0


a source to share


1 answer


//create and start timer

[NSTimer scheduledTimerWithTimeInterval: 0.05 target: self selector: @selector(timerMethod:) userInfo: nil repeats: YES];

// method works 20 times per second
-(void) timerMethod: (NSTimer*)theTimer {
NSLog(@"timer is working");
}

      



+5


a source







All Articles