1

I'm working on a game with main menu and the game itself.

In the game, I'm using this code:

for (i = 20; i > 0; i--)
{
        // Do something...
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
}

There is no problem with the code, but if I go out to the menu (modal segue), the loop continues to run even if I go back to the game, and it causes lots of problems. How can i stop it?

Edit: from some reason this answer not working for me :

CFRunLoopStop(CFRunLoopGetCurrent());
Asi Givati
  • 1,348
  • 1
  • 15
  • 31

1 Answers1

0
CFRunLoopStop(CFRunLoopGetCurrent());
rob mayoff
  • 375,296
  • 67
  • 796
  • 848