FWCollectionViewWaterfallLayout


@interface FWCollectionViewWaterfallLayout : UICollectionViewLayout

The FWCollectionViewWaterfallLayout class is a concrete layout object that organizes items into waterfall-based grids with optional header and footer views for each section.

A waterfall layout works with the collection view’s delegate object to determine the size of items, headers, and footers in each section. That delegate object must conform to the FWCollectionViewDelegateWaterfallLayout protocol.

Each section in a waterfall layout can have its own custom header and footer. To configure the header or footer for a view, you must configure the height of the header or footer to be non zero. You can do this by implementing the appropriate delegate methods or by assigning appropriate values to the headerHeight and footerHeight properties. If the header or footer height is 0, the corresponding view is not added to the collection view.

Note

FWCollectionViewWaterfallLayout doesn’t support decoration view, and it supports vertical scrolling direction only.
  • How many columns for this layout.

    Note

    Default: 2

    Declaration

    Objective-C

    @property (nonatomic) NSInteger columnCount;
  • The minimum spacing to use between successive columns.

    Note

    Default: 10.0

    Declaration

    Objective-C

    @property (nonatomic) CGFloat minimumColumnSpacing;
  • The minimum spacing to use between items in the same column.

    Note

    Default: 10.0

    Note

    This spacing is not applied to the space between header and columns or between columns and footer.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat minimumInteritemSpacing;
  • Height for section header @note If your collectionView’s delegate doesn’t implement collectionView:layout:heightForHeaderInSection:, then this value will be used.

    Default: 0
    

    Declaration

    Objective-C

    @property (nonatomic) CGFloat headerHeight;
  • Height for section footer @note If your collectionView’s delegate doesn’t implement collectionView:layout:heightForFooterInSection:, then this value will be used.

    Default: 0
    

    Declaration

    Objective-C

    @property (nonatomic) CGFloat footerHeight;
  • The margins that are used to lay out the header for each section. @note These insets are applied to the headers in each section. They represent the distance between the top of the collection view and the top of the content items They also indicate the spacing on either side of the header. They do not affect the size of the headers or footers themselves.

    Default: UIEdgeInsetsZero
    

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets headerInset;
  • The margins that are used to lay out the footer for each section. @note These insets are applied to the footers in each section. They represent the distance between the top of the collection view and the top of the content items They also indicate the spacing on either side of the footer. They do not affect the size of the headers or footers themselves.

    Default: UIEdgeInsetsZero
    

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets footerInset;
  • The margins that are used to lay out content in each section. @note Section insets are margins applied only to the items in the section. They represent the distance between the header view and the columns and between the columns and the footer view. They also indicate the spacing on either side of columns. They do not affect the size of the headers or footers themselves.

    Default: UIEdgeInsetsZero
    

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets sectionInset;
  • The direction in which items will be rendered in subsequent rows. @note The direction in which each item is rendered. This could be left to right (FWCollectionViewWaterfallLayoutItemRenderDirectionLeftToRight), right to left (FWCollectionViewWaterfallLayoutItemRenderDirectionRightToLeft), or shortest column fills first (FWCollectionViewWaterfallLayoutItemRenderDirectionShortestFirst).

    Default: FWCollectionViewWaterfallLayoutItemRenderDirectionShortestFirst
    

    Declaration

    Objective-C

    @property (nonatomic) FWCollectionViewWaterfallLayoutItemRenderDirection itemRenderDirection;
  • The minimum height of the collection view’s content. @note The minimum height of the collection view’s content. This could be used to allow hidden headers with no content.

    Default: 0.f
    

    Declaration

    Objective-C

    @property (nonatomic) CGFloat minimumContentHeight;
  • The calculated width of an item in the specified section. @note The width of an item is calculated based on number of columns, the collection view width, and the horizontal insets for that section.

    Declaration

    Objective-C

    - (CGFloat)itemWidthInSectionAtIndex:(NSInteger)section;