Created
August 25, 2013 19:02
-
-
Save dvdsgl/6335596 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Task Animate (double duration, Action animation) | |
{ | |
var complete = new TaskCompletionSource<object> (); | |
UIView.Animate (duration, () => animation (), () => { | |
complete.TrySetResult (null); | |
}); | |
return complete.Task; | |
} | |
async void Dismiss () | |
{ | |
await Animate (0.2, () => { | |
ControlView.Alpha = 0; | |
CoverView.Frame = CoverOrigin; | |
BackgroundView.Alpha = 1; | |
}); | |
// Notify listeners so we can be fully dismissed | |
Dismissed (); | |
} | |
public override async void ViewDidAppear (bool animated) | |
{ | |
ControlView.Alpha = 0; | |
CoverView.Frame = CoverOrigin; | |
BackgroundView.Alpha = 1; | |
await Animate (0.2, () => { | |
CoverView.Frame = CoverDestination; | |
BackgroundView.Alpha = 0; | |
}); | |
await Animate (0.2, () => { | |
ControlView.Alpha = 1; | |
}); | |
base.ViewDidAppear (false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment