Shameem
Shameem

Reputation: 14339

iPhone: ViewController ends up badly after simulating memory warning

I have a view controller HomeViewController which shows some grids. Once I go to an inner view controller by clicking on a grid, I do a "Simulate memory warning" in the Simulator menu. Now, when I press back button go back to HomeViewController, the grids become bare - white in colour.

Any idea why this is happening ? Any suggestions on how to debug this?

Some more details: The HomeViewController view is itself loads from a NIB. Each of the grid (GridView) loads separately from a Grid.xib.

Upvotes: 0

Views: 157

Answers (1)

Ole Begemann
Ole Begemann

Reputation: 135548

The HomeViewController will unload its view when it receives a memory warning while its view is not visible. Make sure you reload everything viewDidLoad that gets unloaded when the view is released. Also, your views must not hold any state on their own; you must be able to reconstruct every view with the data you hold in your model and controller objects.

Upvotes: 1

Related Questions