popViewController to a UIViewController initialized with a UIStoryboardSegue

365 views Asked by At

I have a list controller that fires a performSegueWithIdentifier to load a detailViewController of the item that was selected. To initialize the detailViewController I set a property on it in the prepareForSegue that gets called before the detailView is shown. This all works great.

However...
From the detail view I navigate to a controller that does some memory intensive actions and my detailViewController ends up being unloaded and viewDidUnload gets called.

Now the user presses the back button in the title bar causing popViewController to fire. When my viewDidLoad method for the detailViewController executes again, I haven't had the opportunity to set the appropriate property before it's displayed. So at this point none of my controls display proper/any information.

What is the best way to re-initialize the property on my detailViewController once it has been deallocated and the user navigates back to it? I have thought of setting the "selectedItem" on my AppDelegate to use in this situation but that seems like a hack.

Thanks in advance!

1

There are 1 answers

0
Wolfsokta On BEST ANSWER

I was misunderstanding the scenario of viewDidUnload and releasing items that I actually needed to later rebuild the view. Thank you again Gordon.