Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UICollectionView with Paging Enable

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

like image 818
user3755698 Avatar asked Jun 19 '14 10:06

user3755698


People also ask

How do I make my UICollectionView scroll horizontal?

You need to reduce the height of UICollectionView to its cell / item height and select " Horizontal " from the " Scroll Direction " as seen in the screenshot below. Then it will scroll horizontally depending on the numberOfItems you have returned in its datasource implementation.

What is swift UICollectionView?

An object that manages an ordered collection of data items and presents them using customizable layouts.

How does UICollectionView work?

UICollectionView makes adding custom layouts and layout transitions, like those in Photos, simple to build. You're not limited to stacks and grids because collection views are customizable. You can use them to make circle layouts, cover-flow style layouts, Pulse news style layouts and almost anything you can dream up!


1 Answers

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];

like image 56
Deepak Avatar answered Nov 15 '22 21:11

Deepak