views:

31

answers:

1

I have my code and i recieve the EXC_BAD_ACCESS error when it is suppose to change... any ideas:

-(void) updatePlay {
    UIImage *img = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bursttt" ofType:@"png"]];

    if (CGRectIntersectsRect(pinend.frame, balloonbit1.frame)){
        [maintimer invalidate];
        accelManeger.delegate = nil;
        ball.image = img;
        [UIImageView beginAnimations:nil context:NULL];
        [UIImageView setAnimationDuration:0.3];
        ball.transform = CGAffineTransformMakeScale(2, 2);
        [UIImageView commitAnimations];
    }
}
+1  A: 

It's possible your timer is the problem. You're invalidating it, but not nil'ing it out, so if this code runs more than once without reseting the timer, it'll crash.

Ben Gottlieb
Ahh, i didn't think of that. Cheers mate works perfectly now.
Harry