没有更多背景的动画选项变得暧昧

时间:2016-02-22 12:30:14

标签: ios swift

我创建了一个隐藏特定视图的隐藏功能。但是我不断收到以下错误:“没有更多上下文,表达的类型是模糊的”。我需要提供什么样的背景?

func hide(toFrame:CGRect, delay:NSTimeInterval) {

    UIView.animateWithDuration(animationSettings.duration,
        delay: delay,
        usingSpringWithDamping: animationSettings.damping,
        initialSpringVelocity: animationSettings.velocity,
        options: (.BeginFromCurrentState | .AllowUserInteraction),
        animations:{
            self.frame = self.offScreenFrame
        }, completion: {
            (value: Bool) in
            self.delegate!.didNotifyFinishedAnimation(true)
            self.canNotify = true
        }
    )
}

1 个答案:

答案 0 :(得分:1)

UIViewAnimationOptionsOptionSetType,可以设置语法来定义选项。因此,上述代码需要更改(.BeginFromCurrentState | .AllowUserInteraction)[.BeginFromCurrentState, .AllowUserInteraction]的选项。

UIView.animateWithDuration(animationSettings.duration,
    delay: delay,
    usingSpringWithDamping: animationSettings.damping,
    initialSpringVelocity: animationSettings.velocity,
    options: [.BeginFromCurrentState, .AllowUserInteraction],
    animations:{
        self.frame = self.offScreenFrame
    }, completion: {
        (value: Bool) in
        self.delegate!.didNotifyFinishedAnimation(true)
        self.canNotify = true
    }
)