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 8444863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:30:28+00:00 2026-06-10T09:30:28+00:00

I am developing a game, and I would like to transition between several views,

  • 0

I am developing a game, and I would like to transition between several views, e.g. Menu Screen, Game Screen, Game Over Screen etc. What would be the easiest way of doing this? I’m not sure if I should use a view stack as the order that the views are shown is not always reversed.

  • 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-06-10T09:30:30+00:00Added an answer on June 10, 2026 at 9:30 am

    I assume by “view stack” you mean a UINavigationController?

    The easiest way is to keep references to all of the view controllers somewhere, for example I see people use the application delegate a lot, so your application delegate’s class extension would look a little like:

    @interface AppDelegate ()
    
    @property (nonatomic, strong) UIViewController *rootViewController; //this is what gets set as the window's root VC
    @property (nonatomic, strong) UIViewController *mainScreenViewController;
    @property (nonatomic, strong) UIViewController *gameScreenViewController;
    @property (nonatomic, strong) UIViewController *gameOverScreenViewController;
    
    @end
    

    Assume rootViewController just controls a container view for the rest of the app (You would probably actually be well served putting all this logic into the root view controller though…)

    Now anytime you need to show a certain screen, call a method like:

    - (void)switchToViewController:(UIViewController *)viewController
    {
        [self.rootViewController.view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
        [self.rootViewController.view addSubview:viewController.view];
    }
    

    You can now write methods that are named more memorably like -switchToGameOverScreen

    - (void)switchToGameOverScreen
    {
        [self switchToViewController:self.gameOverScreenViewController];
    } 
    

    This basic pattern of view navigation is roughly found in UITabBarController and often in views controlled by UISegmentedControls.

    Hopefully this helps!

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

Sidebar

Related Questions

I'm developing a PHP game and would like to post players highscores to their
I am developing a computer baseball game based on statistics. I would like to
I am developing a multiplayer game with more than 2 players. I would like
I'm developing a board game and would like to know how i can use
I am developing a 3d shooter game that I would like to run on
I am developing a 3D Game Engine as a project. I would like to
I'm developing a card playing game and would like to print out the symbol
We are developing an iPhone game and I would like to know if is
I'm developing a game in XNA. It would be nice for it to be
I'm developing a game for windows for learning purposes (I'm learning DirectX). I would

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.