向动画添加两个 UIViewAnimationOptions (Swift)
Adding two UIViewAnimationOptions to an animation (Swift)
我有这段代码可以为 table:
设置动画
UIView.animateWithDuration(0.33, delay: 0, options: UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.AllowUserInteraction, animations: { () -> Void in
self.myTableView.setContentOffset(CGPoint(x: 0, y: offSetY), animated: false)
}, completion: nil)
我想要附加选项 UIViewAnimationOptions.AllowUserInteraction
但我收到错误消息:“| 不能应用于两个 UIViewAnimationOptions 操作数”。我怎样才能添加这个?在 objective-c.
工作
在Swift 2
中你必须这样写。 OptionSetType
具有更新的语法。
UIView.animateWithDuration(0.33, delay: 0, options:[UIViewAnimationOptions.CurveEaseOut, UIViewAnimationOptions.AllowUserInteraction], animations: { () -> Void in
self.myTableView.setContentOffset(CGPoint(x: 0, y: 8), animated: false)
}, completion: nil)
我有这段代码可以为 table:
设置动画 UIView.animateWithDuration(0.33, delay: 0, options: UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.AllowUserInteraction, animations: { () -> Void in
self.myTableView.setContentOffset(CGPoint(x: 0, y: offSetY), animated: false)
}, completion: nil)
我想要附加选项 UIViewAnimationOptions.AllowUserInteraction
但我收到错误消息:“| 不能应用于两个 UIViewAnimationOptions 操作数”。我怎样才能添加这个?在 objective-c.
在Swift 2
中你必须这样写。 OptionSetType
具有更新的语法。
UIView.animateWithDuration(0.33, delay: 0, options:[UIViewAnimationOptions.CurveEaseOut, UIViewAnimationOptions.AllowUserInteraction], animations: { () -> Void in
self.myTableView.setContentOffset(CGPoint(x: 0, y: 8), animated: false)
}, completion: nil)