Release NSObject and stop all method calling
<p>So my menu calls a game with this piece of code:</p>

<pre><code>game = [[Game alloc] init];
[self presentModalViewController:memoryTest animated:FALSE];
</code></pre>

<p>A UIViewController then appears with a countdown. The player can go back to the menu DURING the countdown. However when I try this, the countdown keeps running and eventually the game starts, even thought the UIViewController has been dismissed (therefore the UIView has disappeared) in the backToMenu method.</p>

<pre><code>[self.parentViewController dismissModalViewControllerAnimated:FALSE];
</code></pre>

<p>I've tried to release the game object in the viewDidAppear method of the menu, but no luck. I thought of having a "quit" BOOL value, so the countdown can check wether or not the player has quit the game, but there must be a better way to release an object AND stop all method calls inside it.</p>

<p>Thanks for helping me out.</p>

<p>CountDown method:</p>

<pre><code>- (void)countDown {

    SoundEffect *sound = [[SoundEffect alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"tick" ofType: @"wav"]];
    [sound playAndRelease];

    if(self.countDownStep &gt; 0) {
     feedback.image = [UIImage imageNamed:[NSString stringWithFormat:@"countdown%d.png",self.countDownStep]];
     feedback.hidden = FALSE;

     [self performSelector:@selector(countDown) withObject:nil afterDelay:0.8];
    }

    else {
     [self displayMessage:self.startMessage];
     [self.game performSelector:@selector(start) withObject:nil afterDelay:0.8];
     [self performSelector:@selector(hide) withObject:nil afterDelay:0.8];
    }

    self.countDownStep--;

}
</code></pre>
