How to start the transition animation after the user sees the collection view cell?

452 Views Asked by At

i am creating a simple walkthrough page and using collectionview for it. I want show to users a simple transition animation in the last cell.

I use the willdisplaycell method to do this but the animation is not happening.

Can you help with this?

    override func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {

    let lastCell = collectionView.dequeueReusableCell(withReuseIdentifier: signcellid, for: indexPath) as! SignCell

    if indexPath.row == pageImages.count {

        UIView.animate(withDuration: 1, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.5, options: .curveEaseOut) {
            lastCell.logoLabel.transform = CGAffineTransform(translationX: 200, y: 200)
        }

    }

}
0

There are 0 best solutions below