views:

31

answers:

1

i get a memory leak and crash when using this transition more then 7-8 times:

-(IBAction)pan1:(id)sender{

    CATransition *transition = [CATransition animation];
    transition.duration = 0.50;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    NSString *types[4] = {kCATransitionFade};
    int rnd = random() % 4;
    transition.type = types[rnd];
    transitioning = YES;
    transition.delegate = self;
    UIImage *image4 = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"pan_01_cross_0.png" ofType:nil]];
    pan_cross_0 = [[UIImageView alloc] initWithImage:image4];
    [panView.layer addAnimation:transition forKey:nil];
    [panView addSubview:pan_cross_0]; 
}
+2  A: 

At least 1 memory leak I can see with pan_cross_0 if you run the pan method multiple times.

pan_cross_0 = [[UIImageView alloc] initWithImage:image4];

You alloc new image view into pan_cross_0 but not releasing it from the last time. I am not sure what cause crashes. I need more details at least

vodkhang
well, i'm desperated (don't wannoa bother you here). when i start the app on the iopd i suddenly recieve memory warning level=1. i don't get this starting it on the ipad.....
blacksheep