Once the button is tapped after a delay of 5 seconds the total values in the array gets executed.
- (IBAction)testButton:(id)sender {
NSArray *array = [NSArray arrayWithObjects:
@"Hefeweizen", @"IPA", @"Pilsner", @"Stout", nil];
for (NSIndexPath *anIndexPath in array) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
NSLog(@"INDEX PATH %@",anIndexPath);
});
}
How to create delay of 5 sec (given) for every value inside the array ?