Skip to content

Instantly share code, notes, and snippets.

View jgafni's full-sized avatar

Josh Gafni jgafni

  • Tinder
  • Los Angeles
View GitHub Profile
@jgafni
jgafni / UICollectionViewFlowLayoutCenterItem.m
Last active August 29, 2015 14:27 — forked from mmick66/UICollectionViewFlowLayoutCenterItem.m
UICollectionViewFlowLayout with arbitrary sized Paging
#import "UICollectionViewFlowLayoutCenterItem.h"
@implementation UICollectionViewFlowLayoutCenterItem
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
{
CGSize collectionViewSize = self.collectionView.bounds.size;
CGFloat proposedContentOffsetCenterX = proposedContentOffset.x + self.collectionView.bounds.size.width * 0.5f;
CGRect proposedRect = self.collectionView.bounds;