iPhone - dealloc subview UIViewController when removeFromSuperview
Posted
by bbullis21
on Stack Overflow
See other posts from Stack Overflow
or by bbullis21
Published on 2009-09-21T16:57:30Z
Indexed on
2010/04/12
13:03 UTC
Read the original article
Hit count: 301
I have several buttons on my main UIViewController (main menu) that creates and adds a subview UIViewController on top of the main menu. When I remove the subview the memory from that controller is not released. How can I release that subviews memory instantly?
Does anyone have an example? This would solve all my problems! Thanks in advance.
Here is how I add a subview
if((UIButton *) sender == gameClassicBtn) {
GameClassic *gameClassicController = [[GameClassic alloc]
initWithNibName:@"GameClassic" bundle:nil];
self.gameClassic = gameClassicController;
[gameClassicController release];
[self.view insertSubview:gameClassicController.view atIndex:1];
}
© Stack Overflow or respective owner