didReceiveMemoryWarning implementation for navigation controller interface

Discussion in 'iPhone/iPad Programming' started by Mac Me Up, Sep 3, 2008.

  1. macrumors regular

    Joined:
    Jun 25, 2005
    Location:
    Australia
    #1
    Supposing I have 3 views:
    top
    middle
    end
    Set up with a navigation controller eg:
    top -> middle -> end
    in top:
    Code:
    [[self navigationController] pushViewController:middle animated:YES];
    
    in middle:
    Code:
    [[self navigationController] pushViewController:end animated:YES];
    
    and to move back up
    Code:
    [[self navigationController] popViewControllerAnimated:YES];
    
    So this structure works just fine to drill up and down my views. My problem is that if I am at my last view, and I simulate a memory warning, and then drill back down to the middle view, my middle view has been reset (eg: all the controls are back to the defaults, not to how the user might have changed them).

    Is there a piece of the puzzle I'm missing here? The documentation seems to say that my view will only be released if it's not part of the view hiearchy. Do I have to do more than just a push to get it into the view hiearchy?
     
  2. macrumors 6502a

    DipDog3

    Joined:
    Sep 20, 2002
    #2
    Are you releasing it? Can you just save the view info and reload when shown.
     
  3. thread starter macrumors regular

    Joined:
    Jun 25, 2005
    Location:
    Australia
    #3
    I'm not explicitly releasing it no, but when the memory warning is issued it gets released. I guess I could save the object that populates that view and re-populate it every time it loads...is that normal behaviour then?
     

Share This Page