I have created a UICollectionView
that slides its items based on a certain trigger.
I'm trying to animate the cells transition by:
UIView.animate(withDuration: 0.4,
delay: 0.5, animations: {
self.headingsCollectionView.contentOffset = CGPoint(x: x, y: 0)
self.headingsCollectionView.reloadItems(at: [indexPath])
})
The animation is successful, the problem is when I change the CollectionView contentOffset the current item disappears instead of scrolling off.
- I tried reloading the current item (as suggested here) so it would stay visible but it's still not working.
- I've tried
scrollToItemAtIndexPath:atScrollPosition:animated
but it's not animating the item transition. - setContentOffset:animated Tried it, it doesn't animate as well.