views:

41

answers:

0

Having some basic issues with managing the total memory from adding and removeing a uiviewcontroller - but only when i add an animation to it using CAtransition. I set up a simple scenario below of the situation:

I have a basic view controller that I init/alloc called IVC, and I add to the current uiController: IN the header file it is simply just declared:

IntroViewController* IVC;

AT START :3mb total memory shown in leaks

3.6mb total memory

IVC=[[IntroViewController alloc] initWithNibName:@"Intro" bundle:[NSBundle mainBundle]];
[IVC.view setUserInteractionEnabled:YES];   
[self.view addSubview:IVC.view];

then i release:

[[IVC.view layer] removeAllAnimations];
[IVC.view removeFromSuperview];//remove intro animation
[IVC release];

as expected here total memory goes back to 3mb

but when i remove the release code and add the following so that there is a fade in and then release the object shown here:

CATransition *applicationIntroLoadViewIn = [CATransition animation];
[applicationIntroLoadViewIn setDuration:.5];
[applicationIntroLoadViewIn setType:kCATransitionReveal];
[applicationIntroLoadViewIn setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[applicationIntroLoadViewIn setValue:@"IntroFadeIn" forKey:@"IntroAnimation"];
[applicationIntroLoadViewIn setDelegate:self];
[[IVC.view layer] addAnimation:applicationIntroLoadViewIn forKey:nil];

and then :

i create a method to handle when the animation has finished:

- (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)flag{
NSString* value = [animation valueForKey:@"IntroAnimation"];

if ([value isEqualToString:@"IntroFadeIn"]){
    //this def gets called NSLog shows up
    [[IVC.view layer] removeAllAnimations];
    [IVC.view removeFromSuperview];//remove intro animation
    [IVC release];
    IVC=nil;
}

there are no reported leaks, the view is removed , but the memory still stays 3.6MB in Leaks? ANy reason why this would happen? I don't alloc the animation* so i feel that should not need to be cleaned up, but this suggests that something is still holding onto to my IVC view

Any help much appreciated.