iPhone - UIViewController class dealloc function never called
I have an issue with a project of mine.
I have a "Menu" UIViewController class and the dealloc function is never called. Most of the UI was added in Interface Builder and has no IBOutlet.
How can I free the memory if dealloc is not called?
I simulated an memory warning and now dealloc function was called.
Here is an example of my code:
//first.m
- (void) onButton
{ second *modalView = [[second alloc] init];
[self presentModalViewController:modalView animated:YES];
[modalView release];}
So, when I am in second screen and I simulate memory warning should the dealloc from the first class fire?
Anyway, in my application no dealloc is 开发者_开发技巧called :(.
You can try 'Hardware -> Simulate Memory Warning' option in the Simulator to check whether the -dealloc is called.
Interface Builder caches nibs until there's a memory warning, or it exhausts its cache. At such time, it will reclaim any memory that it was using.
精彩评论