Hi all,

I have some animation code that looks like this:

CABasicAnimation *theAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"] ;
        NSLog( @"ANIMATION: started %x" , theAnimation ) ;
        theAnimation.removedOnCompletion = YES ;
        theAnimation.duration = 0.125f ;
        theAnimation.repeatCount = 1 ;
        theAnimation.autoreverses = NO ;
theAnimation.fromValue = [NSNumber numberWithFloat:self.currentlySlidingCell.layer.position.x] ; theAnimation.toValue = [NSNumber numberWithFloat:self.currentlySlidingCell.layer.position.x - self.currentlySlidingCell.frame.origin.x] ;
        theAnimation.delegate = self ;
        self.superview.userInteractionEnabled = NO ;
[self.currentlySlidingCell.layer addAnimation:theAnimation forKey:@"slideResetAnimation"] ;
        
When I run the program (in the iPhone simulator) with Instruments running, I get several CABasicAnimation leaks of 16 bytes. How could I possibly getting this leak if addAnimation:forKey: always replaces the previous animation for the key? I would expect any animation that is replaced for that key would be released by the layer.

There is a possibility in my code for the animation to be removed before it finishes. This method is called from willRemoveSubview of my animating layer's superlayer. it may occur while animating:

- (void) cleanupSliding
        {
        NSLog( @"ANIMATION cleaning up sliding" ) ;
NSAssert( self.currentlySlidingCell != nil , @"_currentlySlidingCell is nil" ) ;

[self.currentlySlidingCell.layer removeAnimationForKey:@"slideResetAnimation"] ;
        …

Could this somehow cause the animation to not get released?

Regardless of whether I remove the animation or not, simply replacing it by setting a new animation with the same key should suffice to release the previous animation, right?

Thanks,

Mike

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to