On Nov 1, 2008, at 2:58 PM, Jeshua Lacock wrote:

On Nov 1, 2008, at 1:51 PM, Ashley Clark wrote:

What are the values of anim and images before you try to add them to the animator? In the code portion you posted you don't show where you're creating your "anim" object.

Yes, sorry, I realized that after I posted. I am creating anim before it is used with:

        CAKeyframeAnimation *anim;
        anim=[CAKeyframeAnimation animationWithKeyPath:@"contents"];

I have also tried:

        CAKeyframeAnimation *anim = [CAKeyframeAnimation animation];

And then setting the animationWithKeyPath property after it is created.


CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"contents"];

and

CAKeyframeAnimation *anim = [CAKeyframeAnimation animation];
[anim setKeyPath:@"contents"];

should be equivalent.


As well I don't see in my version of the SDK where UIAnimator is defined. If you're trying to use private API here, don't. Just set the duration on the anim object directly and add it to your CALayer. You can get the layer used by a view by sending the layer message to the view (NS or UI).

You mean directly by setting the properties like with:

        anim.duration = 3.0;
        anim.values = images;
        anim.calculationMode = @"discrete";
        anim.repeatCount = HUGE_VAL;

anim.duration = 3.0;

is also equivalent to

[anim setDuration:3.0];

The dot syntax for properties is just syntactic sugar.


It's also probably better to use kCAAnimationDiscrete in lieu of @"discrete" in case the constant changes at a later time.

[anim setCalculationMode:kCAAnimationDiscrete];


I have also tried that method.

I have tried adding it to the layer with:

        [[self layer] addAnimations:anim withDuration:1.5 start:YES];

Is that what you mean? Or could you please show me an example?


// where someLayer is initialized elsewhere
CALayer *someLayer;

[someLayer addAnimation:anim forKey:@"imageFlipping"];

The key used at the end is just used as a way for you to remove your animation or retrieve it at a later point.


Good luck,
Ashley

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to