I have created a static method creating and returning an animation that I use in various places in my application. I think this may be causing a leak. If I autorelease theAnimation in the return statement I get a crash because I the animation must be being release before it's complete.
Is this indeed causing a leak? If so, is there another way to do this without a leak?
+(CABasicAnimation *)fadeIn {
CABasicAnimation *theAnimation;
theAnimation = [CABasicAnimation animationWithKeyPath
"opacity"];
theAnimation.fromValue = [NSNumber numberWithFloat:0];
theAnimation.toValue = [NSNumber numberWithFloat:1.0];
theAnimation.duration = 1.0;
return theAnimation;
}
then I us it like this:
CABasicAnimation *anim = [AnimationCreatorUtil fadeIn];
anim.delegate = self;
[[scoreHolderView layer] addAnimation:anim forKey
"fadeIn"];
Thanks!
Is this indeed causing a leak? If so, is there another way to do this without a leak?
+(CABasicAnimation *)fadeIn {
CABasicAnimation *theAnimation;
theAnimation = [CABasicAnimation animationWithKeyPath
theAnimation.fromValue = [NSNumber numberWithFloat:0];
theAnimation.toValue = [NSNumber numberWithFloat:1.0];
theAnimation.duration = 1.0;
return theAnimation;
}
then I us it like this:
CABasicAnimation *anim = [AnimationCreatorUtil fadeIn];
anim.delegate = self;
[[scoreHolderView layer] addAnimation:anim forKey
Thanks!