Reputation: 11
I have assigned the tab bar view controllers using the nib files and when i try to release the tab view controllers as following it's not calling the dealloc functions of any of the view controllers. I am releasing as following:
[appDelegate.tabBarController.view removeFromSuperview];
NSMutableArray * vcs = [NSMutableArray arrayWithArray:[appDelegate.tabBarController viewControllers]];
[[vcs objectAtIndex:2] release]; //tried releasing both ways
[vcs removeObjectAtIndex:2];
[[vcs objectAtIndex:1] release];
[vcs removeObjectAtIndex:1];
[[vcs objectAtIndex:0] release];
[vcs removeObjectAtIndex:0];
[appDelegate.tabBarController setViewControllers:vcs];
Please help me out.
Upvotes: 1
Views: 755
Reputation: 7133
You don't need to call release
explicitly on the view controllers.
They're being retained by the array, so removing them from the array should suffice.
And actually if the view controllers weren't being retained somewhere else, you'd probably be "over releasing" and should expect a crash after this code runs...
So look somewhere else for this. Instruments is your friend.
Upvotes: 2