PLVFeedViewDataSource

Objective-C

@protocol PLVFeedViewDataSource <NSObject>

@required

/// 提供集合视图包含的section(分区)数量
- (NSInteger)numberOfSectionsInFeedView:(PLVFeedView *)feedView;

/// 提供每个section包含的item(单元格)数量
- (NSInteger)feedView:(PLVFeedView *)feedView numberOfItemsInSection:(NSInteger)section;

/// 根据IndexPath提供对应遵循PLVFeedItemCustomViewDelegate的视图
- (UIView <PLVFeedItemCustomViewDelegate>*)feedView:(PLVFeedView *)feedView contentViewForItemAtIndexPath:(NSIndexPath *)indexPath;

/// 上拉刷新回调
///
/// @param feedView feed流组件
/// @param completion 完成回调,不执行触发completion不会进行下次回调
- (void)feedViewNeedsRefresh:(PLVFeedView *)feedView completion:(void (^)(BOOL refresh))completion;

/// 下拉加载回调
///
/// @param feedView feed流组件
/// @param completion 完成回调,不执行触发completion不会进行下次回调
- (void)feedViewNeedsLoadMore:(PLVFeedView *)feedView completion:(void (^)(BOOL lastPage))completion;

@end

Swift

protocol PLVFeedViewDataSource

Undocumented

  • 提供集合视图包含的section(分区)数量

    Declaration

    Objective-C

    - (NSInteger)numberOfSectionsInFeedView:(nonnull PLVFeedView *)feedView;

    Swift

    func numberOfSections(in feedView: PLVFeedView!) -> Any!
  • 提供每个section包含的item(单元格)数量

    Declaration

    Objective-C

    - (NSInteger)feedView:(nonnull PLVFeedView *)feedView
        numberOfItemsInSection:(NSInteger)section;

    Swift

    func feedView(_ feedView: PLVFeedView!, numberOfItemsInSection section: Any!) -> Any!
  • 根据IndexPath提供对应遵循PLVFeedItemCustomViewDelegate的视图

    Declaration

    Objective-C

    - (id)feedView:(nonnull PLVFeedView *)feedView
        contentViewForItemAtIndexPath:(nonnull NSIndexPath *)indexPath;

    Swift

    func feedView(_ feedView: PLVFeedView!, contentViewForItemAtIndexPath indexPath: Any!) -> Any!
  • 上拉刷新回调

    Declaration

    Objective-C

    - (void)feedViewNeedsRefresh:(nonnull PLVFeedView *)feedView
                      completion:(nonnull void (^)(BOOL))completion;

    Swift

    func feedViewNeedsRefresh(_ feedView: PLVFeedView!) async -> Int32

    Parameters

    feedView

    feed流组件

    completion

    完成回调,不执行触发completion不会进行下次回调

  • 下拉加载回调

    Declaration

    Objective-C

    - (void)feedViewNeedsLoadMore:(nonnull PLVFeedView *)feedView
                       completion:(nonnull void (^)(BOOL))completion;

    Swift

    func feedViewNeedsLoadMore(_ feedView: PLVFeedView!) async -> Int32

    Parameters

    feedView

    feed流组件

    completion

    完成回调,不执行触发completion不会进行下次回调