gpt4 book ai didi

ios - 向动画添加两个 UIViewAnimationOptions (Swift)

转载 作者:搜寻专家 更新时间:2023-11-01 06:41:39 24 4
gpt4 key购买 nike

我有这段代码可以为表格设置动画:

    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)

关于ios - 向动画添加两个 UIViewAnimationOptions (Swift),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34449275/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com