0
votes

I have a RootViewController, and multiple ViewControllers that branch out from the same when certain buttons are pressed i.e.

-(IBAction)newWorkoutButton
{
    [self presentModalViewController:newWorkoutViewController animated:YES];
}

When a user presses the back button, the current ViewController animates back to the previous ViewController i.e.

   -(IBAction)backButton
    {
        [self dismissModalViewControllerAnimated:YES];
    }

The problem is, I want the ViewControllers to UNLOAD whenever the backButton is pressed. At the moment they are not unloading because when I go back to them they are still in the previous state.

Regards, Stephen

1

1 Answers

0
votes

You could set up the root view controller at the delegate of the child view and on view did unload of the child view, remove it from the superview. The other more simple option is when pushing the subview recreate it and add it as a child, (Insert it into the index of the subViews array that the last version of that child was added to)