How to implement automatic transition to the detailed page if the user was previously (or corrected my code for this, which has a design flaw)

Any recommendations for resolving this problem I have, or perhaps a better implementation design?

Demand

  • It is necessary that the application at launch launches the user to the page with the previous details, if that was what they were before leaving the application in the last session.
  • If they were on the main screen of the application, then at restart they can remain here.
  • I'm supposed to be working with a UINavigationController, and the home screen and details screen is built on a UITableViewController

My implementation concept

  • Put the check in "viewdidLoad" to find out if they were on the detail screen, and then, if so, go to that (see code below)

Problem

  • It works fine, however, when I run a warning about a memory warning, everything is fine and I get strange navigation behavior. For example, I see navigation buttons on the main page when it looks like I'm on a detail page page (UITableView).

My analysis

  • From what I see, when I am on the details page (assignmentsListController) and gives a warning about a failure in the simulator, I see:

    (a) "viewDidLoad", , , BACK (UINavigationController), (RootViewController), ,

    (b) , [AppointmentListController viewDidLoad], , , dealloc AppointmentListController (.. A, B, A - dealloc ...)

  • , , .

, ? ( , )

- (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]; 
    } 

}
+3
1

: , , . , , , , .. , , : , .

- , , . , , (.. → ). setViewControllers. , .

+2

All Articles