我创建了一个隐藏特定视图的隐藏功能。但是我不断收到以下错误:“没有更多上下文,表达的类型是模糊的”。我需要提供什么样的背景?
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
}
)
}
答案 0 :(得分:1)
UIViewAnimationOptions
是OptionSetType
,可以设置语法来定义选项。因此,上述代码需要更改(.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
}
)