I am trying to add an animation to my collection view cells so that they animate when the collection view is scrolled. At the moment it is working, but it interferes with a library I'm using which allows the cells to be reordered.
It's difficult to explain what's happening, but there is basically a 'ghost' cell in the position that the cell you are dragging to has just moved from. Regardless, I need to figure out a way to detect when the cells are being reordered so that I can cancel the animation.
This is the library I'm using: https://github.com/ra1028/RAReorderableLayout
And this is the animation:
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)
}
Anyone have any suggestions?