iOS: How to use a delay call to a method or execute a time or with intervals
In iOS or and its underlying Framework extends it to use Grand Central Dispatch (GCD) . So in this example, let say you wanted to call or execute a method at a specified time, you can use the code below, Say you wanted to play an audio file after 2 seconds. NSURL *audioURL = [ [ NSBundle mainBundle ] URLForResource : @"TheAudioFile" withExtension : @ "mp3" ] ; NSError * error; AVAudioPlayer * audioPlayer = [ [ AVAudioPlayer alloc ] initWithContentsOfURL : audioURL error :& error ] ; dispatch_time_t popTime = dispatch_time ( DISPATCH_TIME_NOW, 2.0 * NSEC_PER_SEC ) ; // where 2.0 as a second * nano seconds dispatch_after ( popTime, di...