0

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!

Wolfsokta
  • 71
  • 4
  • viewDidUnload is calling for the view to be released, not the view controller. You shouldn't lose your property as long as the VC is still there. Are you releasing the VC your self? – Gordon Dove Jul 31 '12 at 09:07
  • Could it be that easy? I'll have to double check that tonight, but I think the dealloc is being called on my VC. – Wolfsokta Aug 01 '12 at 23:36

1 Answers1

0

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

Wolfsokta
  • 71
  • 4