I need to implement an animation which looks like the attached gif.
When you tap on a cell, it should zoom in and accordingly the spacing between cells should maintain(Cell shouldn't overlap).When you select another cell the currently selected cell animate to original size and the newly selected cell zoom in the same time.
Currently, in when the user selects the cell I'm calling reload for UICollectionView and in cellForItemAtIndex I have kept some delay to animate the image using "CGAffineTransform.scale".
But with this approach I'm not getting the desired animation, there is a noticeable flickering.
func animateTheCellOnTapping(cell:RatingFeedbackCell, indexPath:IndexPath) {
cell.overlayView.transform = CGAffineTransform.identity
UIView.animate(withDuration: 0.2, animations: {
if indexPath == self.selectedIndex {
cell.imagesContainerView.transform = CGAffineTransform(scaleX: 1.1, y: 1.1)
}
})
if indexPath != selectedIndex {
cell.imagesContainerView.transform = CGAffineTransform.identity
}
}
Is there any other way to do this?
Note
The above animation I have done using UIScrollView, but I wanted to do the same using UICollectionView.