Skip to content

Instantly share code, notes, and snippets.

@follesoe
Created April 25, 2011 15:37
Show Gist options
  • Save follesoe/940685 to your computer and use it in GitHub Desktop.
Save follesoe/940685 to your computer and use it in GitHub Desktop.
MonoTouch animation helper by @alex_york and @follesoe
public static class AnimationService
{
public static void FadeOut(this UIView view, float duration = 1.0f, float opacity = 0.0f)
{
Animate(duration, () => {
view.Layer.Opacity = opacity;
});
}
public static void Animate(double duration, Action block)
{
UIView.BeginAnimations(Guid.NewGuid().ToString());
UIView.SetAnimationDuration(duration);
block();
UIView.CommitAnimations();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment