有关于MonoTouch的新的基于块的动画的好的教程吗?
我所知道的是,这不是通常的方法:
UIView.BeginAnimations("ImageMove");
//code to make changes to the view (move controls, swap views, etc.)
UIView.CommitAnimations();
...可从iOS 4.0获得的新的基于块的动画方法使用:
UIView.Animate(0.2, () => { /* code to animate */ });
要么:
UIView.Animate(0.2, delegate() { /* code to animate */ });
但是,更详尽的教程将很有用。
提前致谢。
最佳答案
对于monotouch
的基于块的动画,该方法是:
Animate(double, double, UIViewAnimationOptions, MonoTouch.Foundation.NSAction, MonoTouch.Foundation.NSAction)
//Animate( animateWithDuration:delay:options:animations:completion )
您可以将其称为HERE。
代码示例如下:
UIView.Animate(0.2, () => { /* code to animate */ });
要么
UIView.Animate(0.2, delegate() { /* code to animate */ });
HERE是
UIViewAnimationOptions
的枚举列表。我使用以下方法为
cocoa-touch
做基于块的动画,将代码粘贴到这里,也许有人需要:[UIView animateWithDuration:delay:options:animations:completion:]
详细说明是:
[UIView animateWithDuration:<#(NSTimeInterval)#>
delay:<#(NSTimeInterval)#>
options:<#(UIViewAnimationOptions)#>
animations:<#^(void)animations#>
completion:<#^(BOOL finished)completion#>];
您可以像这样制作动画:
[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
}
}];
关于ios - 有关于MonoTouch的新的基于 block 的动画的好的教程吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8398323/