I have to create Grid view like Appstore iOS app. I want to do this with UICollectionView paging. I have also implemented the code but not able to scroll like that.
What I want to do is there will one image in Center and at both sides(left and right), it should show some portion of previous and next image. I have set Frame for UICollectionView is 320*320. cell size is 290*320.(cell min spacing is 10)1
Below are two links which depicts my requirement. Thanks in advance.
(This is what I want) 2
Here's a working swift4 version of Rickster answer:
Have you tried setting the scroll direction of your UICollectionViewFlowLayout to horizontal?
[yourFlowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
You'll need to enable paging on your collection view like so:
[yourCollectionView setPagingEnabled:YES];
If you use pagining in collectionView it will scroll by one page Not one cell. You can disable pagining and implement ScrollViewDelegate
Only one different from standart paging: If you drag fast Collection will scroll more than one cell. And don't forget to add UIScrollViewDelegate
Just use collectionView.isPagingEnabled = true;
I took shtefane's answer and improved on it. Enter your own
cellWidth
andcellPadding
values.Ref to Rickster's answer and I rewrite with Swift 4: