views:

246

answers:

2

Hi!

I'm presenting a modalViewController. After I dismiss the modal view controller with:

- (void)dismissModalViewControllerAnimated:(BOOL)animated

.. the view is still in memory. How do I dismiss it such that it will use memory?

Thanks.

A: 

When you present your modal view controller, you need to release it.

Paul Lynch
Of course. Before I present the modalViewController, I allocate at first a UINavigationController and UIViewController, add the UIViewController to the UINavigationController as rootViewController, afterwards I present the modalViewController and release both UINavigationController and UIViewController. What else to do??
burki
Make sure that all of these are released from your code. Having a retain on any of them will hold your controller. Check for other values that you may have passed in and not released.
Paul Lynch
A: 

I'm having the same problem. I'm only temporarily retaining the ViewController until I call presentModalViewController, then release the alloc. But after dismissModalViewControllerAnimated, I never get the ViewController's dealloc.

If I add a self-release from the ViewController, then I get this after control returns to the event loop:

Program received signal: “EXC_BAD_ACCESS”. objc_msgSend

paiego