Skip to content

A UICollectionViewLayout subclass to put items in a quilting pattern

License

Notifications You must be signed in to change notification settings

bryceredd/RFQuiltLayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4f61d7e · Dec 26, 2015

History

46 Commits
Feb 19, 2013
Aug 29, 2013
Nov 24, 2014
Dec 14, 2015
Dec 14, 2015
Dec 14, 2015
Feb 19, 2013
Feb 19, 2013
Dec 8, 2015

Repository files navigation

RFQUILTLAYOUT

RFQuiltLayout is a UICollectionViewLayout subclass, used as the layout object of UICollectionView.

Demo 1 Demo 2

Installation

Add the layout as the subclass of your UICollectionViewLayout.

Subclass the layout

Make sure you set the delegate of the flow layout

- (void) viewDidLoad {
  // ...

  RFQuiltLayout* layout = (id)[self.collectionView collectionViewLayout];
  layout.direction = UICollectionViewScrollDirectionVertical;
  layout.blockPixels = CGSizeMake(100, 100);
}

- (CGSize) blockSizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row % 2 == 0)
        return CGSizeMake(2, 1);
    
    return CGSizeMake(1, 2);
}

(Note: all delegate methods and properties are optional)

About

A UICollectionViewLayout subclass to put items in a quilting pattern

Resources

License

Stars

Watchers

Forks

Packages

No packages published