Is there a good tutorial about the new block-based animations with MonoTouch?
All I know is that instead of the usual method:
UIView.BeginAnimations("ImageMove");
//code to make changes to the view (move controls, swap views, etc.)
UIView.CommitAnimations();
...the new block-based animation method, available from iOS 4.0, uses:
UIView.Animate(0.2, () => { /* code to animate */ });
or:
UIView.Animate(0.2, delegate() { /* code to animate */ });
But a more extensive tutorial would be useful.
Thanks in advance.
For monotouch
's block-based animation, the method is:
Animate(double, double, UIViewAnimationOptions, MonoTouch.Foundation.NSAction, MonoTouch.Foundation.NSAction)
//Animate( animateWithDuration:delay:options:animations:completion )
You can refer it HERE.
Code sample like this:
UIView.Animate(0.2, () => { /* code to animate */ });
or
UIView.Animate(0.2, delegate() { /* code to animate */ });
And HERE is a enumeration list for UIViewAnimationOptions
.
I use the method below to do block-based animation for cocoa-touch
, paste the code here maybe someone else need:
[UIView animateWithDuration:delay:options:animations:completion:]
Detail description is:
[UIView animateWithDuration:<#(NSTimeInterval)#>
delay:<#(NSTimeInterval)#>
options:<#(UIViewAnimationOptions)#>
animations:<#^(void)animations#>
completion:<#^(BOOL finished)completion#>];
You can do animation like:
[UIView animateWithDuration:0.3f
delay:0.0f
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
// Do your animtion here;
[yourViewController.view setAlpha:0.0];
// ...
}
completion:^{
if (finished) {
// Do sth that after the animation
}
}];