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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:57:17+00:00 2026-05-11T17:57:17+00:00

I have a multi view application with individual UIViewControllers and xibs. I have one

  • 0

I have a multi view application with individual UIViewControllers and xibs. I have one view that is the game view and every time I call it I want it to re-initialize, by that I mean restart at it’s initial condition and not in the state I last left it in.

Here is the code block I am using to load and remove views:

-(void)loadStartViewController {
[currentView.view removeFromSuperview];
StartViewController *startViewController = [[StartViewController alloc] initWithNibName:@"StartView" bundle:nil];
[window addSubview:startViewController.view];
currentView = startViewController;

}

I should be more clear here. I have a UIViewController and a xib that make up the view while the game is being played. They call a method in a UIView to programatically draw the view. I leave the UIViewController when the game ends and I go to a score screen. I want to have the user restart and go back into the game, IE load the UIViewController with the above code but start with a new game, all settings are in the method called. I could just set a variable and pass it between UIViewControllers but I though there might be a command that would allow me to reset the game UIViewController so it does not remember anything about the state at the end of the last game.

To make it work I wrote a method to reset all the variables in the UIView that draws the game screen and call that method from the UIViewController in the viewDidLoad section.

  • 1 1 Answer
  • 1 View
  • 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-11T17:57:18+00:00Added an answer on May 11, 2026 at 5:57 pm

    I assume your view is displaying some data stored in model (game state). So wouldn’t you want to reset the game state and let the view display it? The view is managed (loaded/released/reloaded) by the system when it needs to be displayed or released when memory on phone is low. So if you handle your game state separately you should update the game state (the model) and let the view display it.

    What do you mean my “calling the view”? Do you mean when you go from a ‘menu’ to ‘a game screen’?

    Maybe re-loading the game state after the view is displayed would help. There are some delegates like viewDidLoad but my understanding is that they are being called after the view is loaded. However, if you’re running out of memory your view may be release and reloaded later so I guess you should manage the game ‘state’ yourself in model object and let the view just display it.

    Not sure if that helps, I’m not quite sure what you meant my ‘calling the view’.

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

Sidebar

Related Questions

I have a multi-line string that I want to do an operation on each
I have a multi-timezone web application that stores all of the datetime values in
I have a multi-threaded Windows application that occasionally deadlocks. Inevitably this happens on a
I have an iPhone application that is mostly using standard controls. There is one
Modern browsers have multi-tab interface, but JavaScript function window.showModalDialog() creates a modal dialog that
I have a multi-user ASP.NET app running against SQL Server and want to have
I create an application base on view based Application project . so i have
I have an view-based application where the user can do a lot of customization
I have an ASP.NET MVC application with quite a few drop-down lists and multi-select
I would like to have an OpenGL view with an utility application. What I

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.