我的动画完成处理程序出现问题。我正在尝试调出一个 UILabel 来显示加载状态。状态在 Init() 方法中更新。
问题是标签(loadingLabel)出现在 Init() 的末尾而不是动画的末尾。
谢谢
这是我的代码:
AnimationManager.BounceAppear (
this.logoImage,
duration: 0.5,
delay: 1,
onFinished:
() => {
this.loadingLabel.Hidden = false;
// Long Process which update loadingLabel
Init ();
}
);
public static void BounceAppear(UIView view, double delay = 0.5, double duration = 0.3, Action onFinished = null)
{
double interval = duration/ 2.0f;
view.Transform = CGAffineTransform.MakeScale(0.001f, 0.001f);
UIView.AnimationWillEnd += () => {
};
UIView.Animate(
interval,
delay,
UIViewAnimationOptions.CurveLinear,
()=>
{
view.Transform = CGAffineTransform.MakeScale(1.1f, 1.1f);
},
()=>
{
UIView.Animate(
interval,
()=> view.Transform = CGAffineTransform.MakeScale(0.9f,0.9f),
()=>
{
UIView.Animate(
interval,
()=> view.Transform = CGAffineTransform.MakeIdentity(),
()=> { if(onFinished != null){ onFinished(); }} );
}
);
});
}