ios - UICollectionViewCell Snap to Centre -
I have added a UICollectionView that contains 5 cells, horizontally scrolling. I would like the users to scroll between the cells, where each cell will draw a picture in the center. Here is a code used with my UICollectionFlowLayout cell size.
- (UICollectionViewFlowLayout *) collectionLayout {if (_collectionLayout!) {_collectionLayout = [[UICollectionViewFlowLayout alloc] init] _collectionLayout.minimumInteritemSpacing = 0; _collectionLayout.minimumLineSpacing = 30; Dictionary _collectionLayout.itemSize = CGSizeMake (200, 165); _collectionLayout.sectionInset = UIEdgeInsetsMake (0, 65, 0, 55); _collectionLayout.collectionView.pagingEnabled = Yes; } Return _collectionLayout; } I have added the inset, so the first and the last cell in the middle closes, though there are no three cells in between. Please see attached screen shots to describe - [2 screen shots below]
I can easily get the centralized paging of cells if they are the width of the screen or I just take 5 squares, then Even if I do this, then the user who needs me very much knows that there is more to scroll to, if you know what I mean left or right to other cells Please, do not see.
I have read the same answers about disabling paging and using the scrollViewWillEndDragging methods, but I could not find them to work either. Anyone can offer a clear way to do that would be great,
thanks in advance
Jim
Michael Elkan