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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:52:07+00:00 2026-06-02T14:52:07+00:00

This may be impossible, but I’m trying to save the state of my application

  • 0

This may be impossible, but I’m trying to save the state of my application between scene transitions, but I can’t figure out what to do. Currently I love the way that when you have an application running and hit the home button, you can go back to that application just where you left off, but if you transition between scenes (in a storyboard), once you get back to that scene the application state was not saved.

I only have two different scenes that need to be saved (you transition back and forth from one to the other). How can I go about saving a storyboard scenes state without taking up precise memory?

More Detailed: Here is my entire storyboard. You transition back and forth between scenes using the plus toolbar button. On the second scene the user can tap on the table view cells and a real image will fill the image view (See figure 1.2)

Figure 1.1Figure 1.1

In figure 1.2 you see what happens when you tap inside one of the many table view cells (an image view pops up.)

Figure 1.2 Figure 1.2

THE PROBLEM: When you tap a table view cell, which fills an image view (shown in figure 1.2) it works fine if you stay on that scene or even hit the iPhone home button (if you hit the iPhone home button and then reopen the app the scene’s state was saved and the image view filled with a simple image still shows just like we left it), but if I transition (using the plus button) back to the first scene, and then use the plus button on the first scene to get back to the second scene the image view that I created (shown in figure 1.2) disappears and the second scene loads without saving the state and image views we filled.

EDIT: I tried using the same view controller for both scenes, but it didn’t solve the problem.

UPDATE: I just found the following code (that I think stores a views state). How could I use this and is this what I’ve been looking for?

MyViewController *myViewController=[MyViewController alloc] initWithNibName:@"myView" bundle:nil];
[[self navigationController] pushViewController:myViewController animated:YES];
[myViewController release];
  • 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-02T14:52:08+00:00Added an answer on June 2, 2026 at 2:52 pm

    I would suggest a combination of two things:
    1. Take DBD‘s advice and make sure that you don’t continuously create new views
    2. Create a shared class that is the data controller (for the golfers, so that the data is independent of the scene)

    The correct way to make the segues would be to have one leading from the view controller on the left to the one on the right. However, to dismiss the one on the right you can use

    -(IBAction)buttonPushed:(id)sender 
          [self dismissModalViewControllerAnimated:YES];
    }
    

    This will take you back the the view controller on the left, with the view controller on the left in its original state. The problem now is how to save the data on the right.

    To do this, you can create a singleton class. Singleton classes have only one instance, so no matter how many times you go to the view controller on the right, the data will always be the same.

    Singleton Class Implementation (Of a class called DataManager) – Header

    @interface DataManager : NSObject {
    }
    
    +(id)initializeData;
    -(id)init;
    @end
    

    Singleton Class Implementation (Of a class called DataManager) – Main

    static DataManager *sharedDataManager = nil;
    
    @implementation DataManager
    +(id)initializeData {
        @synchronized(self) {
            if (sharedDataManager == nil)
                sharedDataManager = [[self alloc] init];
        }
        return sharedDataManager;
    }
    
    -(id)init { 
        if(self == [super init]) {
        } 
        return self;
    }
    @end
    

    Then, inside your view controller code you can grab this instance like this

    DataManager *sharedDataManager = [DataManager initializeDataManager];
    

    This way you will have the same data no matter how many times you switch views.
    Also, you can better adhere to MVC programming by keeping you data and your view controllers separate. (http://en.wikipedia.org/wiki/Model–view–controller)

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

Sidebar

Related Questions

I think what I am trying to do here may be impossible, but this
I think that this may be impossible, but what I was trying to do
This may be a simple question but I can;t find the answer anywhere. Here
This may seem a bit crazy, but if you can tell me a better
This may be a stupid question, but I'm trying to replicate a customer's OpenLDAP
This may seem as an almost impossible question, but I wish to know how
This may sound impossible but read on. I need to learn jQuery a little
I know this may be impossible but... I just got an app approved, and
This may be stupadly easy, or just impossible - but it's worth asking in
I realise that this question may be almost impossible to answer definitively, but: Is

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.