Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Living Off the Grid with UICollectionViews

Jay Thrash
September 11, 2013

Living Off the Grid with UICollectionViews

A presentation on using Collection Views and creating custom Collection View Layouts.

Sample code available on Github at: https://github.com/jaythrash/CollectionViewLayoutDemo

Presentation originally given at 360iDev 2013 in Denver, CO

Jay Thrash

September 11, 2013
Tweet

More Decks by Jay Thrash

Other Decks in Technology

Transcript

  1. Living the Grid with UICollectionView Off UICollectionView 360iDev September 2013

    Denver, CO Jay Thrash @jaythrash jaythrash.com Wednesday, September 11, 13
  2. Origin •Introduced in iOS 6 •New & Improved UITableView •Makes

    Grid Layouts Very Easy •Implement adaptive layouts Wednesday, September 11, 13
  3. Organization Familiar “3D’s” UITableView Patterns • Data Source • Delegate

    • Dequeing Improves & Extends • New Content View types • Decoupling of layout Wednesday, September 11, 13
  4. The 3D’s - Dequeing •Follows same cell reuse patterns as

    UITableView •Register class for reuse identifier [collectionView registerClass:[MyCell class] forCellWithReuseIdentifier:@”My_Cell_Id”]; New Wednesday, September 11, 13
  5. 3D’s - Dequeing [collectionView registerClass:[MyCell class] forCellWithReuseIdentifier:@”My_Cell_Id”]; - (UICollectionView*)collectionView:(UICollectionView*)cv cellForItemAtIndexPath:(NSIndexPath*)indexPath

    { MyCell *cell = [cv dequeReusableCellWithReuseIdentifier@”My_Cell_Id”]; if (!cell) { .... } // configure cell content cell.actorNameLabel.text = @”Sean Connery”; return cell; } Wednesday, September 11, 13
  6. 3D’s - Dequeing [collectionView registerClass:[MyCell class] forCellWithReuseIdentifier:@”My_Cell_Id”]; - (UICollectionView*)collectionView:(UICollectionView*)cv cellForItemAtIndexPath:(NSIndexPath*)indexPath

    { MyCell *cell = [cv dequeReusableCellWithReuseIdentifier@”My_Cell_Id”]; if (!cell) { .... } // configure cell content cell.actorNameLabel.text = @”Sean Connery”; return cell; } if (!cell) { .... } Wednesday, September 11, 13
  7. Content View Types Set A Set B •Cells •Supplimentary Views

    •Decoration Views Wednesday, September 11, 13
  8. Content View Types Set A Set B •Cells •Supplimentary Views

    •Decoration Views Wednesday, September 11, 13
  9. Content View Types Set A Set B •Cells •Supplimentary Views

    •Decoration Views Wednesday, September 11, 13
  10. Cell Anatomy view Casino Royale Daniel Craig, Eva Green, Mads

    Mikkelsen, Giancarlo Giannini Nov 17, 2006 Wednesday, September 11, 13
  11. UICollectionViewFlowLayout Cell Views • Cell Size • Line Spacing •

    Inter-item Spacing • Register Class Wednesday, September 11, 13
  12. UICollectionViewFlowLayout Cell Views • Cell Size • Line Spacing •

    Inter-item Spacing • Register Class Supplimentary Views • Header Size • Register Class Wednesday, September 11, 13
  13. UICollectionViewFlowLayout Cell Views • Cell Size • Line Spacing •

    Inter-item Spacing • Register Class Supplimentary Views • Header Size • Register Class Decoration Views • Register Class Wednesday, September 11, 13
  14. Where to go next? Parallactic Collection Views Rene Cacheaux https://github.com/

    RCacheaux/Parallax Introduction to Collection Views Mark Pospesel https://github.com/ mpospese/ IntroducingCollectionViews Wednesday, September 11, 13
  15. Mothership • Introducing Collection Views • Advanced Collection Views and

    Building Custom Layouts • Custom Transitions Using View Controllers Wednesday, September 11, 13