I try to center with animation a cell in collectionview vertically, but it doesn't work. I am using this code:
self.slotCollectionView.selectItem(at: indexPath, animated: true, scrollPosition: UICollectionViewScrollPosition.centeredVertically)
self.slotCollectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: true)
Every time I use this, it centers at the bottom of the collection view. I am sure that the selectItem selects the correct cell. It is just a problem of bad positioning…
What can I do?