[![collectionview example][1]][1]
I am trying to emulate this behavior using a collection view. I have started by working with this method and it has gotten me closer. Although as I swipe further and further right on my horizontal paging CollectionView, the content shifts further and further left. Also the spacing between the cells is off. I believe it requires a custom layout, but am not sure.
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return CGSize(width: collectionView.frame.width - 20, height: collectionView.frame.height - 20)
}
I've changed a bit @Mohamed's solution and it worked perfectly for me:
it depends on 3 factors 1) Section Insets 2) Cell Spacing 3) Cell Size
Any change in each you have to change others for your case
1) Set left & right with 20
2) set cell spacing to 10
3) Set cell size
4) this will center cell in screen