Remove ViewController from memory
Hopefully load the ViewController and do something and then unload (viewDidUnload) 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 the offsetModalViewControllerAnimated function does not trigger the viewDidUnload event of the Viewcontroller5.
I am trying to execute a function, but it caused the program to crash. I am also trying to removeFromSuperView, but it is not raising the ViewDidUnload event.
Any comment welcome
thanks
InterDev
a source to share
viewDidUnload
only called when your application receives a memory warning and the view is inactive. It is commonly used to release stored views (including IBOutlets). You can use viewWillDisappear
or viewDidDisappear
to respond to a dismissal ( dealloc
will also be called eventually, but not necessarily exactly when the submission is dismissed).
a source to share
A rejected UIViewController will not fire viewDidUnload as you discovered. However, this will call the viewWillDisappear method if it suits your needs.
a source to share