如何为UIViewAnimation定义多个选项?

Ser*_*ost 21 iphone uiviewanimation

可能这只是一个正确语法的问题.

我使用animateWithDuration:delay:options:animations:completion:UIView方法.

options:这里是有问题的一部分:当我给你只有一个选项(例如UIViewAnimationOptionCurveEaseInOut)一切工作正常.

如果我想为同一个动画分配多个选项怎么办?我怎样才能做到这一点?

我尝试了以下代码,但options:部分结果被完全忽略了:

>   [UIView animateWithDuration:DURATION
>                         delay:DELAY
>                       options:(UIViewAnimationOptionAllowUserInteraction,
>                                UIViewAnimationOptionCurveEaseInOut)
>                    animations: ^{/*animations here*/}
>                    completion: ^(BOOL finished){/*actions on complete*/}];
Run Code Online (Sandbox Code Playgroud)

这只是一次尝试而且没有用.我应该在这里使用哪种语法?

在此先感谢您的帮助.

Vla*_*mir 53

Objective-C的

options:(UIViewAnimationOptionAllowUserInteraction |
                            UIViewAnimationOptionCurveEaseInOut)
Run Code Online (Sandbox Code Playgroud)

迅速

在Swift中,UIViewAnimationOptions是一个Option集类型,可以通过以下方式传递多个选项:

options:[.AllowUserInteraction, .CurveEaseInOut]
Run Code Online (Sandbox Code Playgroud)