Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 233585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:06:53+00:00 2026-05-11T20:06:53+00:00

So my menu calls a game with this piece of code: game = [[Game

  • 0

So my menu calls a game with this piece of code:

game = [[Game alloc] init];
[self presentModalViewController:memoryTest animated:FALSE];

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.

[self.parentViewController dismissModalViewControllerAnimated:FALSE];

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.

Thanks for helping me out.

CountDown method:

- (void)countDown {

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

    if(self.countDownStep > 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--;

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:06:53+00:00Added an answer on May 11, 2026 at 8:06 pm

    In the viewcontroller’s viewWillDisappear, check if the timer is running. If it is, then just invalidate it.

    [timerObject invalidate] will stop the timer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am calling this function from the menu and calls the upload(item) function to
This menu works great, except my background disappears in Opera and Internet Explorer plus
I have a dropdown menu, on change of this, I need to set the
onActivityResult is giving me major headaches. My little game has a title / menu
I have a page with a menu that uses JQuery AJAX calls to populate
I have this issue when I would like to go the Game Over screen.
I have a usual iOS Cocos2d game. I start with a MainMenuViewController, which then
I have a main activity (main menu / home screen) Most of my game
I am currently trying to create a menu system for a game and cannot
I want to add an option to the finder context menu that calls hg

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.