The waterfall (i.e., Pinterest-like) layout for UICollectionView.
delegate
property, your collectionView's delegate MUST conforms to <CHTCollectionViewDelegateWaterfallLayout>
protocol.minimumColumnSpacing
and minimumInteritemSpacing
properties.itemWidth
property. The layout object will calculate a proper item width automatically.- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout heightForItemAtIndexPath:(NSIndexPath *)indexPath
to - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
. It should return original size for each item.sectionInset
correctly.