【问题标题】:non clickable cell, wen animation is on [duplicate]不可点击的单元格,温动画在[重复]
【发布时间】:2019-05-10 21:17:24
【问题描述】:

我在我的项目中使用简单的动画

    let rotationTransform = CATransform3DTranslate(CATransform3DIdentity, 0, 50, -40)
    cell.layer.transform = rotationTransform
    cell.alpha = 0.5
    UIView.animate(withDuration: 0.75) {
        cell.layer.transform = CATransform3DIdentity
        cell.alpha = 1.0
    }

问题是当我快速向下滚动页面(我的 UiCollectionView 有很多单元格)并尝试在中间的某个位置停止滚动时,它对我不起作用,因为单元格外观的动画仍然持续。事实证明,虽然动画没有结束——它们是不可点击的

是否有任何技巧或功能使单元格在播放动画时可点击?

【问题讨论】:

    标签: swift animation uicollectionviewcell catransform3d


    【解决方案1】:

    您可以在选项中添加allowUserInteraction

    UIView.animate(withDuration: 0.75,delay:0.0,options:[.allowUserInteraction], animations: {
      cell.layer.transform = CATransform3DIdentity
      cell.alpha = 1.0
    }) { (ok) in
        print("Ended \(ok)") 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-10
      • 2021-05-01
      • 1970-01-01
      • 2017-01-15
      • 2012-11-07
      • 1970-01-01
      • 2014-01-14
      • 2015-01-28
      相关资源
      最近更新 更多