Objective-C Language Creating a Timer


Example

This will create a timer to call the doSomething method on self in 5.0 seconds.

[NSTimer scheduledTimerWithTimeInterval:5.0
         target:self 
         selector:@selector(doSomething) 
         userInfo:nil 
         repeats:NO];

Setting the repeats parameter to false/NO indicates that we want the timer to fire only once. If we set this to true/YES, it would fire every five seconds until manually invalidated.