ios – 如何在swift中动画内容(xcode 6 beta)

前端之家收集整理的这篇文章主要介绍了ios – 如何在swift中动画内容(xcode 6 beta)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道如何用苹果的新语言快速动画.

在目标c中,我将使用以下代码将图像从屏幕顶部移动到结尾:

[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
    UIImageView.center = CGPointMake(UIImageView.center.x,UIImageView.center.y + 200);
} completion:^(BOOL finished) {
    [self move];
}];

所以questoin是:

>我如何使用与上面的代码(obj c)相同的效果在swift中制作动画,
我会很感激你对这种方式的解释.

解决方法

UIView.animateWithDuration(1,delay: 0,options: .CurveLinear,animations: {
    UIImageView.center = CGPointMake(UIImageView.center.x,UIImageView.center.y + 200);
},completion: {
    (finished: Bool) in
    move();
});

这是怎么回事.

猜你在找的Xcode相关文章