Instance Method

initWithDuration:curve:animations:

Initializes the animator with a built-in UIKit timing curve.

Declaration

- (instancetype)initWithDuration:(NSTimeInterval)duration curve:(UIViewAnimationCurve)curve animations:(void (^)(void))animations;

Parameters

duration

The duration of the animation, in seconds.

curve

The UIKit timing curve to apply to the animation.

animations

The block containing the animations. This block has no return value and takes no parameters. Use this block to modify any animatable view properties. When you start the animations, those properties are animated from their current values to the new values using the specified animation parameters.

Return Value

An initialized animator object or nil if the object could not be created.

Discussion

Use this method to create an animator object that uses the existing UIKit timing curves to control the animation behavior. Standard UIKit timing curves include UIViewAnimationCurveLinear and UIViewAnimationCurveEaseInOut among others.

The animator object returned by this method begins in the UIViewAnimatingStateInactive state. You must explicitly start the animations by calling the startAnimation method.

See Also

Initializing a Property Animator

- initWithDuration:controlPoint1:controlPoint2:animations:

Initializes the animator object with a cubic Bézier timing curve.

- initWithDuration:dampingRatio:animations:

Initializes the animator object with spring-based timing information.

- initWithDuration:timingParameters:

Initializes the animator object with a custom timing curve object.

+ runningPropertyAnimatorWithDuration:delay:options:animations:completion:

Creates and returns an animator object that begins running its animations immediately.