Instance Method

addAnimation:forKey:

Add the specified animation object to the layer’s render tree.

Declaration

- (void)addAnimation:(CAAnimation *)anim forKey:(NSString *)key;

Parameters

anim

The animation to be added to the render tree. This object is copied by the render tree, not referenced. Therefore, subsequent modifications to the object are not propagated into the render tree.

key

A string that identifies the animation. Only one animation per unique key is added to the layer. The special key kCATransition is automatically used for transition animations. You may specify nil for this parameter.

Discussion

If the duration property of the animation is zero or negative, the duration is changed to the current value of the kCATransactionAnimationDuration transaction property (if set) or to the default value of 0.25 seconds.

See Also

Layer Animations

- animationForKey:

Returns the animation object with the specified identifier.

- removeAllAnimations

Remove all animations attached to the layer.

- removeAnimationForKey:

Remove the animation object with the specified key.

- animationKeys

Returns an array of strings that identify the animations currently attached to the layer.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software