views:

43

answers:

1

I have a view which is slideshow settings, and another view which has a slideshow. Unfortunately, these views conflict because they are still in memory.

As far as I know, viewDidUnload and dealloc are only called in low-memory situations, and dealloc should not be called directly, so how do I completely remove a view. These views are within uinavigationcontrollers by the way.

+1  A: 

If you've added a view with UINavigationController remove it with PopViewController.

Pseudocode:

UIView *newView = [[UIView alloc] init]; // retain = 1 
[UINavigationController pushView: newView]; // retain = 2 
[newView release]; //retain = 1

[UINavigationController popView]; //retain = 0, object will get destroyed
Stephen Furlani
That doesn't remove it from memory, just the screen
cannyboy
I edited my answer to reflect your question. popping the view DOES release it, since pushing it retains it. if you're not seeing the view get destroyed, you're not releasing it in the function you allocate it.
Stephen Furlani