I have a UICollectionView
and it has quite a lot of UICollectionViewCells
on it. I want to scroll the cell to the centre of the UICollectionView<
Swift 3 solution for scrolling and centering screen to make the tapped item visible:
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: true)
}
This doesn't add inset above or under the collectionView
!