I was just wondering, if there was any way of pausing a for loop.
For instance,
for (i = 0; i<10 ; i++) {
NSLog(i);
//Pause should go here
}
The outcome should be: 1 (wait 1 sec) 2 (wait 1 sec) etc.
Firstly, I thought that you could add SKAction *wait = [SKAction waitForDuration:1 completion:^{
, but then I wasn't sure if you could resume the loop from inside the completion brackets.
I have looked around and found NSTimer
, but I am not sure how you could implement this, because I would have to call the loop after each interval and it i
would never be more than 0.
Is there any way that you could pause the loop for an amount of time, then have it resume enumerating?