加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

uiview – 在Swift 2中设置animateWithDuration中的选项

发布时间:2020-12-14 04:49:02 所属栏目:百科 来源:网络整理
导读:我使用以下代码为文本字段设置动画: UIView.animateWithDuration(0.5,delay: 0.4,options: .Repeat | .Autoreverse | .CurveEaSEOut,animations: { self.password.center.x += self.view.bounds.width },completion: nil) 我收到错误找不到会员’重复’ 只
我使用以下代码为文本字段设置动画:

UIView.animateWithDuration(0.5,delay: 0.4,options: .Repeat | .Autoreverse | .CurveEaSEOut,animations: {
            self.password.center.x += self.view.bounds.width
        },completion: nil)

我收到错误找不到会员’重复’

只有在我只设置一个选项时,代码才有效.为什么不让我设置多个选项?

解决方法

组合OptionSetType的语法已更改,您可以这样做:

UIView.animateWithDuration(0.5,options: [.Repeat,.CurveEaSEOut,.Autoreverse],animations: {
        self.password.center.x += self.view.bounds.width
    },completion: nil)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读