RFQUILTLAYOUT
RFQuiltLayout is a UICollectionViewLayout subclass, used as the layout object of UICollectionView.
Installation
Add the layout as the subclass of your UICollectionViewLayout.
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 {
switch (indexPath.section) {
case 0:
return CGSizeMake(1, -100); // Negative values will set absolute values;
default:
if (indexPath.row % 2 == 0)
return CGSizeMake(1, 2);
else
return CGSizeMake(2, 1);
}
}
(Note: all delegate methods and properties are optional)