UICollectionView(InfiniteScrollConvenienceInterface)

@interface UICollectionView (InfiniteScrollConvenienceInterface)

Convenience interface for UIScrollView+InfiniteScroll category.

  • Setup infinite scroll handler

    Declaration

    Objective-C

    - (void)addInfiniteScrollWithHandler:
        (nonnull void (^)(UICollectionView *_Nonnull))handler;

    Swift

    func addInfiniteScroll(handler: @escaping (UICollectionView) -> Void)

    Parameters

    handler

    a handler block

  • Set a handler to be called to check if the infinite scroll should be shown

    Declaration

    Objective-C

    - (void)setShouldShowInfiniteScrollHandler:
        (nonnull BOOL (^)(UICollectionView *_Nonnull))handler;

    Swift

    func setShouldShowInfiniteScrollHandler(_ handler: @escaping (UICollectionView) -> Bool)

    Parameters

    handler

    a handler block

  • Finish infinite scroll animations

    You must call this method from your infinite scroll handler to finish all animations properly and reset infinite scroll state

    Declaration

    Objective-C

    - (void)finishInfiniteScrollWithCompletion:
        (nullable void (^)(UICollectionView *_Nonnull))handler;

    Swift

    func finishInfiniteScroll(completion handler: ((UICollectionView) -> Void)? = nil)

    Parameters

    handler

    a completion block handler called when animation finished