How to remove all UINavigationController objects from memory

Discussion in 'iOS Programming' started by 99miles, Apr 23, 2009.

  1. macrumors member

    Joined:
    Oct 10, 2008
    #1
    I have a main view showing with a button that will open a navigation controller:

    Code:
    	 
    pView = [[PreferencesViewController alloc] init];
    navigationController = [[UINavigationController alloc] initWithRootViewController:pView];
    [pView release];
    [ window addSubview:[navigationController view] ];
    
    Then you can navigate within the navigation controller to other views which are pushed on like:

    Code:
        [[self navigationController] pushViewController:subViewController animated:YES];
    
    But when you back up out of the navigation it will remove all those views:

    Code:
    [[navigationController view] removeFromSuperview];
    [navigationController release];
    navigationController = nil;
    
    But only the dealloc of the rootViewController is getting called. How would I go about removing all the other views that were opened in the navigation?
    I would have thought that by clearing out the navigationContoller that would take care of it, but apparently not.
     

Share This Page