2010-04-08 70 views
1

我有我的代码,我收到当它想改变...任何想法的EXC_BAD_ACCESS错误:iPhone SDK,EXC_BAD_ACCESS更改图像?

-(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

有可能你的计时器问题。你使它无效,但不能将它清零,所以如果这段代码在不重置计时器的情况下运行多次,它会崩溃。

+0

啊,我没有想到这一点。欢呼队友现在完美的作品。 – Harry 2010-04-08 12:50:12