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

  • SEARCH
  • Home
  • 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 1808294
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:14:38+00:00 2026-05-17T06:14:38+00:00

Apologies for the long post and I hope it makes some sense to someone

  • 0

Apologies for the long post and I hope it makes some sense to someone out there.

I have written an iPhone game (in Quartz 2d) which uses the following structure :

  • App delegate loads a view controller called gameviewcontroller and its associated view
  • In the “View did load” method, the gameviewcontroller starts up and initiates a Game Controller class (NSObject). It also starts a timer on a “Game Loop” method in the Game Controller. Finally it tells the Game Controller to use the same view as the gameview controller (which is a custom UIView).

This all works fine. I am now trying to integrate a Main Menu for the game. So far I have done the following :

  • Created a new View Controller called “Main Menu” with an associated NIB. In the NIB I have created my main menu with a “Start” button.
  • Altered the app delegate to load the Main Manu NIB and display its view.
  • Set a method so that when the button is pressed it then loads the gameviewcontroller (which effectively starts the game).

So far so good – pressing the “start” button starts the game. But…..

The problem is now that I can’t find a way for the Game Controller to call up the Main Menu class (e.g for when game is over). I can’t use “self dismissModalViewController” as Game Controller is an NSObject class and not a view controller. How can I get the Game Controller to pull up my Main Menu ?

Thanks all for reading,

Martin

  • 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-17T06:14:38+00:00Added an answer on May 17, 2026 at 6:14 am

    If you have your menu object still living just call its “dissmisModalViewController”.
    for example [[MainMenu getInstance] dismissModalViewControllerAnimated:YES]; where getInstance returns your object or have it stored in GameController as property, so when you create GameController from your MainMenu or GameViewController just assign itself as his property gameInstance.mainMenu = self;

    How-to make getInstance method:

    You could either use Singleton pattern ( you can get one from apple dev site ) or if you manually create MainMenu you could just remember self in some global variable and getInstance would be class method, something like that:

    @interface MainMenu : UIViewController 
    { 
    } 
    + (MainMenu*) getInstance; 
    @end 
    

    and in implementation

    MainMenu *singleInstance; 
    @implementation MainMenu 
    - (id)init 
       { 
         if((self = [super init])) 
         { 
           singleInstance = self; 
         } return self; 
        } 
    
     + (MainMenu*)getInstance 
     { 
        return singleInstance; 
     } 
    @end;
    

    Hope this helps,

    Krzysztof Zabłocki

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

Sidebar

Related Questions

Apologies for the long post, I have tried to provide you with as much
Apologies for the long post, but I wonder if I could get some more
Apologies for the long code post but am wondering if someone can help with
Apologies for the rather verbose and long-winded post, but this problem's been perplexing me
Apologies in advance for the relatively long post - I've tried to provide as
[Apologies for the long winded explanation] I have inherited an aold application with a
Please bear with me, my apologies if this post is too long... I'm attempting
(My apologies for the long post) To jazz up my AQGridView, the attached code
First, appologies for the long post, I have tried to cut it down as
Apologies in advance for rather long post and lot of code. My application has

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.