GuybrushThreepwood
GuybrushThreepwood

Reputation: 5616

Dealloc method not being called in dismissModelViewController?

My modal view controller is not calling its dealloc method when it dismisses itself. I have presented it using :

ViewController * vl = [[ViewController alloc] initWithNibName:@"ViewController" bundle:[NSBundle mainBundle]];  
self.viewLink = vl;

[mainMenu stop];
[mainMenu setCurrentTime:0.0];

[vl release];

[self presentModalViewController:viewLink animated:NO];

Any ideas ?

Thanks,

Martin

Upvotes: 0

Views: 762

Answers (2)

Nimrod
Nimrod

Reputation: 5133

You may not really need to set viewLink because when you present a modal view controller a reference to it will be stored in self.modalViewController. This will automatically get set to nil once you dismiss the controller and the dismissal animation has finished.

Upvotes: 2

Chuck
Chuck

Reputation: 237110

Assuming viewLink is a @property(retain), it isn't being deallocated because that object is retaining the modal view controller.

Upvotes: 0

Related Questions