Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Leak when animating Core Animation Superlayer



On May 31, 2008, at 16:39, "Stéphane Droux" <email@hidden>

> When I run the program in MallocDebug, the memory usage goes up every time the timer function is executed. If I change the animation to be on l2 instead of l1, or if I create l2 as a sublayer of mainLayer, the memory usage remains constant. Am I doing something wrong ?


An NSTimer is not really the appropriate way to do this. Have a look at CABasicAnimation, which you might use in the following manner (untested code written on an iPhone, so no guarantees):


CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"opacity"];

[anim setFromValue:1.0];
[anim setToValue:0.2];
[anim setAutoreverses:YES];
[anim setDuration:1.0];

[l2 addAnimation:anim forKey:nil];

I would recommend reviewing the Core Animation documentation for additional examples.

/brian

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.