views:

29

answers:

1

Hello,

I have application with multiple UIViewControllers using navigation controller. UIViewController contains tableView, searchbar (that I can show/hide) and toolbar. All of this is added as subviews to its view. All this subviews are created after UIViewController is initialized and their content depend on UIVievController's content.

It works fine expect one problem. When I play with my app a little, move back and forth, open some modal views etc sometimes after navigating back to my root VC all it's subviews dissapear and all I get is white screen.

I double checked all my code and I can't find source of problem (I certainly don't remove them myself). I wasn't able to find exact patern how to reproduce this, it seems random. Any idea why iphone would remove my subviews from VC? I would post some code, but I don't want to put it all here and I am not sure which part is important, so if you wish to see some, let me know

+1  A: 

Add your views in loadView or viewDidLoad: when viewDidUnload is called, the view is released, so they need to be created again when the view is shown again.

chpwn
Is view unloaded even if it's controller is still in navigation stack? I thought as long as they are in stack, their views are not released... I will try it and let you know
Lope
Yes, it is. According to the documentation, that can happen in low memory situations.
chpwn
Looks like you were right :) Thanks a lot for your help!
Lope