I hope to load an ViewController and do something then unload (viewDidUnload) it from memory.
if (self.vViewController5.view.superview==nil)
{
ViewController5 *blueController =
[[ViewController5 alloc] initWithNibName:@"View5" bundle:nil];
self.vViewController5 = blueController;
[self.vViewController5 setDelegate:self];
[blueController release];
}
[self presentModalViewController:vViewController5 animated:YES];
later, call
[self dismissModalViewControllerAnimated:YES];
but I found that dismissModalViewControllerAnimated does not trigger the event viewDidUnload of Viewcontroller5.
I try function release but it caused program collapse.
I also try removeFromSuperView but it does not trigger the event ViewDidUnload neither.
Welcome any comment
Thanks
interdev
viewDidUnloadis only called when your application receives a memory warning, and the view is not active. It’s generally used for releasing retained views (including IBOutlets). You can useviewWillDisappearorviewDidDisappearto respond to a dismissal (deallocwill also be called eventually, but not necessarily exactly when the view is dismissed).