Skip to content

Instantly share code, notes, and snippets.

View jklp's full-sized avatar

Jerrold Poh jklp

View GitHub Profile
@jklp
jklp / gist:7d4201e3d9801ba78945
Created July 29, 2014 06:30
Snaps UICollectionViewCell to center when cell isn't entire width of screen
//
// Code based on http://markuzweb.blogspot.com.au/2014/02/uicollectionview-paging-for-smaller-width-cells.html
//
// Note, need to create property called "previousXoffset" in class and doesn't need to be
// initialized by default
//
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint *)targetContentOffset {