重新排序集合视图时限制单元格动画

时间:2015-10-05 23:36:15

标签: ios swift animation uicollectionview uicollectionviewcell

我正在尝试将动画添加到我的集合视图单元格中,以便在滚动集合视图时进行动画处理。目前它正在工作,但它干扰了我正在使用的库,它允许重新排序单元格。

很难解释发生了什么,但是你正拖动的单元格中的位置基本上有一个“幽灵”单元格。无论如何,我需要找出一种方法来检测单元格何时被重新排序,以便我可以取消动画。

这是我正在使用的库:https://github.com/ra1028/RAReorderableLayout

这就是动画:

func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) {        
    cell.layer.transform = CATransform3DMakeScale(0.1,0.1,1)
    cell.alpha = 0
    UIView.animateWithDuration(0.35, delay: 0, options: UIViewAnimationOptions.AllowUserInteraction, animations: {
        cell.layer.transform = CATransform3DMakeScale(1,1,1)
    }, completion: nil)

    UIView.animateWithDuration(0.45, delay: 0, options: UIViewAnimationOptions.AllowUserInteraction, animations: {
        cell.alpha = 1
    }, completion: nil)
}

有人有任何建议吗?

0 个答案:

没有答案