Re: Leak when animating Core Animation Superlayer
Re: Leak when animating Core Animation Superlayer
- Subject: Re: Leak when animating Core Animation Superlayer
- From: Brian Christensen <email@hidden>
- Date: Sat, 31 May 2008 18:14:06 -0400
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:
This email sent to email@hidden