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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:22:52+00:00 2026-05-23T00:22:52+00:00

Any advice on how to fix this issue I have, or a better implementation

  • 0

Any advice on how to fix this issue I have, or a better implementation design perhaps?

Requirement

  • Needed a way for the application at start up to take the user to the previous details page, if this was what they were on prior to quiting the application in their last session
  • If they were on the main screen of the app, then at restart they can stay here
  • The assumption is I’m working with UINavigationController and the main screen and details screen are built on a UITableViewController

My Implementation Concept

  • Put a check in “viewdidLoad” to see whether they were on a detailed screen, and then if so jump to this (refer to code below)

Issue

  • Works fine normally, however when I trigger a memory warning things screw up and I get nav bar weird behavior. For example I see the main page nav buttons, when it looks like I’m on the detail page content (UITableView)

My Analysis

  • From what I see when I am on the details page (appointmentsListController) and cause a memory warning in the simulator I see:

    (a) the main page “viewDidLoad” actually gets called, which my concept didn’t expect, so whilst I had hit the BACK button from the detailed view (UINavigationController) to go to the main view (RootViewController), in fact my code is run and it try’s to throw the user back to the details page again

    (b) I note in my logs after this point that [AppointmentListController viewDidLoad] seems to get called before the previous AppointmentListController dealloc method is called (i.e. like I was in controller A, went back to controller B, but got thrown back to A – and the initial dealloc for the first part didn’t kick in until late…)

  • So I guess it’s obvious my idea isn’t too great

Question

Any suggestions on how to better implement my requirement? (how to check, which method to put them in)

Code

- (void)viewDidLoad {
    [super viewDidLoad];

    // My Implementation of the Requirements which seems flawed in the case there is memory warning triggered 
    if ( previousSelectedScreen >= 0 ) {

        // Setup New Controller
        AppointmentListController *appointmentListController = [[AppointmentListController alloc] initWithNibName:@"AppointmentListController" bundle:nil];
        appointmentListController.screenToShow = previousSelectedScreen;

        // Push new view onto stack
        [[self navigationController] pushViewController:appointmentListController animated:NO];
        [appointmentListController 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-05-23T00:22:53+00:00Added an answer on May 23, 2026 at 12:22 am

    Here’s what I’d suggest: rather than having this logic in your view controller, but it in your application delegate. By constructing your navigation stack before displaying it you will hopefully avoid some of the weird things that can happen with nav bars, etc. To get rid of the memory warnings you may need to look at how your app allocates memory: it may not necessarily be to do with this.

    Anyway – in your application delegate you can perform your check to see if the user was on a detail page when they exited. If they are, you can create an array containing the navigation stack (ie, Main Screen -> Details Page). You can then pass this into a navigation controller using its setViewControllers method. Once this is done, you can display your window and finish launching the app.

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

Sidebar

Related Questions

Does someone have any tips/advice on database design for a web application? The kind
Does anyone have any advice for a consistent way to unit test a multithreaded
Any advice on how to migrate an existing Delphi 7 business application to .NET
Do you have any advice/rules on selecting a multiplier to use in a (multiplicative)
Any advice or links or sample application (for VS2010) re how to develop a
Does anybody have any advice about using Mercurial as a front end for Perforce?
I'd appreciate any advice on which way to go on in the following scenario.
Do you have any advice for writing a Lisp dialect/interpreter in Python? I'd like
Any advice on how to read auto-incrementing identity field assigned to newly created record
Any advice what has worked for you when dealing with user-entered markup, e.g. wiki

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.