UIView.AddKeyframeWithRelativeStartTime(Double, Double, Action) Method

Definition

Adds a single keyframe to an animation.

[Foundation.Export("addKeyframeWithRelativeStartTime:relativeDuration:animations:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 7, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public static void AddKeyframeWithRelativeStartTime (double frameStartTime, double frameDuration, Action animations);
static member AddKeyframeWithRelativeStartTime : double * double * Action -> unit

Parameters

frameStartTime
Double

The starting time of the animation, relative to the containing action (0-1)

frameDuration
Double

The duration of the animation, relative to the containing action (0-1).

animations
Action

The action defining the ending state of the keyframe.

Attributes

Remarks

This method, when called within the animations action of a call to AnimateKeyframes(Double, Double, UIViewKeyframeAnimationOptions, Action, UICompletionHandler), specifies a keyframe in an animation sequence. Both the frameStartTime and frameDuration parameters range fro m 0 to 1 and specify durations relative to the enclosing AnimateKeyframes(Double, Double, UIViewKeyframeAnimationOptions, Action, UICompletionHandler)duration parameter.

For instance, in the following example (which shows the use of both passed-in T:Foundation.NSAction parameters and a C# lambda expression), the third keyframe's frameStartTime and frameDuration are both set to 0.5; since the the containing AnimateKeyframesAsync(Double, Double, UIViewKeyframeAnimationOptions, Action)'s duration is set to 3 seconds, this animation will start at 1.5 seconds and take 1.5 seconds to complete.

var animationSucceeded = await UIView.AnimateKeyframesAsync(
		duration : 3,
		delay : 0,
		options: UIViewKeyframeAnimationOptions.AllowUserInteraction,
		animations: () => {
			UIView.AddKeyframeWithRelativeStartTime(0, 0.25, () => label.Frame = new RectangleF(label.Frame.Left + 250, label.Frame.Top, label.Frame.Width, label.Frame.Height)
				);
			UIView.AddKeyframeWithRelativeStartTime(0.25, 0.25, keyframe2);
			UIView.AddKeyframeWithRelativeStartTime(0.5, 0.5, keyframe3);
		}
	);

Applies to