To use presentModalViewController I must alloc and initWithNibName:bundle: a view. My question is: where do I release it? Does the dismissModalViewController:animated: handle the release?
No. If you allocatet and initialized it, than you have to release it. Do it like this:
YourViewController *controller = [[YourViewController alloc] initWithNibName:@"YourView" bundle:nil];
[self presentModalViewController:controller animated:YES];
[controller release];
PresentModalViewController:animated: increases automatically the retainCount. And as soon as the controller disappeared from the view, it will release the controller. And so the controller will be deallocated. ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With