FWCollectionViewDelegateWaterfallLayout

@protocol FWCollectionViewDelegateWaterfallLayout <UICollectionViewDelegate>

The FWCollectionViewDelegateWaterfallLayout protocol defines methods that let you coordinate with a FWCollectionViewWaterfallLayout object to implement a waterfall-based layout. The methods of this protocol define the size of items.

The waterfall layout object expects the collection view’s delegate object to adopt this protocol. Therefore, implement this protocol on object assigned to your collection view’s delegate property.

  • Asks the delegate for the size of the specified item’s cell.

    @return The original size of the specified item. Both width and height must be greater than 0.

    Declaration

    Objective-C

    - (CGSize)collectionView:(nonnull UICollectionView *)collectionView
                        layout:
                            (nonnull UICollectionViewLayout *)collectionViewLayout
        sizeForItemAtIndexPath:(nonnull NSIndexPath *)indexPath;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    indexPath

    The index path of the item.

  • Asks the delegate for the column count in a section

    @return The original column count for that section. Must be greater than 0.

    Declaration

    Objective-C

    - (NSInteger)collectionView:(nonnull UICollectionView *)collectionView
                         layout:
                             (nonnull UICollectionViewLayout *)collectionViewLayout
          columnCountForSection:(NSInteger)section;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    section

    The section.

  • Asks the delegate for the height of the header view in the specified section.

    @return The height of the header. If you return 0, no header is added.

    @note If you do not implement this method, the waterfall layout uses the value in its headerHeight property to set the size of the header.

    @see headerHeight

    Declaration

    Objective-C

    - (CGFloat)collectionView:(nonnull UICollectionView *)collectionView
                          layout:
                              (nonnull UICollectionViewLayout *)collectionViewLayout
        heightForHeaderInSection:(NSInteger)section;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    section

    The index of the section whose header size is being requested.

  • Asks the delegate for the height of the footer view in the specified section.

    @return The height of the footer. If you return 0, no footer is added.

    @note If you do not implement this method, the waterfall layout uses the value in its footerHeight property to set the size of the footer.

    @see footerHeight

    Declaration

    Objective-C

    - (CGFloat)collectionView:(nonnull UICollectionView *)collectionView
                          layout:
                              (nonnull UICollectionViewLayout *)collectionViewLayout
        heightForFooterInSection:(NSInteger)section;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    section

    The index of the section whose header size is being requested.

  • Asks the delegate for the insets in the specified section.

    @note If you do not implement this method, the waterfall layout uses the value in its sectionInset property.

    @return The insets for the section.

    Declaration

    Objective-C

    - (UIEdgeInsets)collectionView:(nonnull UICollectionView *)collectionView
                            layout:(nonnull UICollectionViewLayout *)
                                       collectionViewLayout
            insetForSectionAtIndex:(NSInteger)section;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    section

    The index of the section whose insets are being requested.

  • Asks the delegate for the header insets in the specified section.

    @note If you do not implement this method, the waterfall layout uses the value in its headerInset property.

    @return The headerInsets for the section.

    Declaration

    Objective-C

    - (UIEdgeInsets)collectionView:(nonnull UICollectionView *)collectionView
                            layout:(nonnull UICollectionViewLayout *)
                                       collectionViewLayout
           insetForHeaderInSection:(NSInteger)section;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    section

    The index of the section whose header insets are being requested.

  • Asks the delegate for the footer insets in the specified section.

    @note If you do not implement this method, the waterfall layout uses the value in its footerInset property.

    @return The footerInsets for the section.

    Declaration

    Objective-C

    - (UIEdgeInsets)collectionView:(nonnull UICollectionView *)collectionView
                            layout:(nonnull UICollectionViewLayout *)
                                       collectionViewLayout
           insetForFooterInSection:(NSInteger)section;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    section

    The index of the section whose footer insets are being requested.

  • Asks the delegate for the minimum spacing between two items in the same column in the specified section. If this method is not implemented, the minimumInteritemSpacing property is used for all sections.

    @note If you do not implement this method, the waterfall layout uses the value in its minimumInteritemSpacing property to determine the amount of space between items in the same column.

    @return The minimum interitem spacing.

    Declaration

    Objective-C

    - (CGFloat)collectionView:(nonnull UICollectionView *)collectionView
                                          layout:(nonnull UICollectionViewLayout *)
                                                     collectionViewLayout
        minimumInteritemSpacingForSectionAtIndex:(NSInteger)section;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    section

    The index of the section whose minimum interitem spacing is being requested.

  • Asks the delegate for the minimum spacing between colums in a secified section. If this method is not implemented, the minimumColumnSpacing property is used for all sections.

    @note If you do not implement this method, the waterfall layout uses the value in its minimumColumnSpacing property to determine the amount of space between columns in each section.

    @return The minimum spacing between each column.

    Declaration

    Objective-C

    - (CGFloat)collectionView:(nonnull UICollectionView *)collectionView
                                       layout:(nonnull UICollectionViewLayout *)
                                                  collectionViewLayout
        minimumColumnSpacingForSectionAtIndex:(NSInteger)section;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    section

    The index of the section whose minimum interitem spacing is being requested.

  • Asks the delegate for the pin offset of the header view in the specified section.

    @return The pin offset of the header. If you return less than 0, header pin is disabled in the specified section.

    Declaration

    Objective-C

    - (CGFloat)collectionView:(nonnull UICollectionView *)collectionView
                             layout:(nonnull UICollectionViewLayout *)
                                        collectionViewLayout
        pinOffsetForHeaderInSection:(NSInteger)section;

    Parameters

    collectionView

    The collection view object displaying the waterfall layout.

    collectionViewLayout

    The layout object requesting the information.

    section

    The index of the section whose pin offset is being requested.