Share via


UIView.Animate 方法

定义

重载

Animate(Double, Action)

对指定操作中发生的属性更改进行动画处理。

Animate(Double, Action, Action)

对指定操作中发生的属性更改进行动画处理,并在动画完成时调用完成回调。

Animate(Double, Double, UIViewAnimationOptions, Action, Action)

通过指定持续时间、延迟、选项和完成处理程序,调用对一个或多个视图的动画更改。

Animate(Double, Action)

对指定操作中发生的属性更改进行动画处理。

[Foundation.Export("animateWithDuration:animations:")]
public static void Animate (double duration, Action animation);
static member Animate : double * Action -> unit

参数

duration
Double

动画的持续时间(以秒为单位)。

animation
Action

包含将应用于视图的更改的代码。

属性

注解

不建议使用此方法。 应用程序开发人员应首选使用 UIViewPropertyAnimator 类来对 UIView 进行动画处理。

这将使用 CurveEaseOut 和 TransitionNone 标志作为动画。

// Animates hiding the label by setting the alpha to zero over three seconds.
UIView.Animate (3, () => { label.Alpha = 0; });

适用于

Animate(Double, Action, Action)

对指定操作中发生的属性更改进行动画处理,并在动画完成时调用完成回调。

[Foundation.Advice("Use the *Notify method that has 'UICompletionHandler completion' parameter, the 'bool' will tell you if the operation finished.")]
public static void Animate (double duration, Action animation, Action completion);
static member Animate : double * Action * Action -> unit

参数

duration
Double

动画的持续时间(以秒为单位)。

animation
Action

包含将应用于视图的更改的代码。

completion
Action

动画完成时调用的代码。

属性

注解

不建议使用此方法。 应用程序开发人员应首选使用 UIViewPropertyAnimator 类来对 UIView 进行动画处理。

这将使用 CurveEaseOut 和 TransitionNone 标志作为动画。

// Animates hiding the label by setting the alpha to zero over three seconds.
UIView.Animate (3, () => { label.Alpha = 0; });

适用于

Animate(Double, Double, UIViewAnimationOptions, Action, Action)

通过指定持续时间、延迟、选项和完成处理程序,调用对一个或多个视图的动画更改。

[Foundation.Advice("Use the *Notify method that has 'UICompletionHandler completion' parameter, the 'bool' will tell you if the operation finished.")]
public static void Animate (double duration, double delay, UIKit.UIViewAnimationOptions options, Action animation, Action completion);
static member Animate : double * double * UIKit.UIViewAnimationOptions * Action * Action -> unit

参数

duration
Double

动画的持续时间(以秒为单位)。

delay
Double

动画开始前的延迟。

options
UIViewAnimationOptions

动画选项

animation
Action

包含将应用于视图的更改的代码。

completion
Action

动画完成时调用的代码。

属性

注解

不建议使用此方法。 应用程序开发人员应首选使用 UIViewPropertyAnimator 类来对 UIView 进行动画处理。

此方法启动一组要对此视图执行的动画。 动画参数中指示的操作包含一个或多个视图属性的动画代码。

适用于