GHRefreshCollectionView.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // GHRefreshCollectionView.h
  3. // GameHelper
  4. //
  5. // Created by 青秀斌 on 16/12/29.
  6. // Copyright © 2016年 kylincc. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @protocol GHRefreshCollectionViewDelegate;
  10. NS_ASSUME_NONNULL_BEGIN
  11. @interface GHRefreshCollectionView : UICollectionView
  12. @property (weak, nonatomic) IBOutlet id<GHRefreshCollectionViewDelegate> refreshDelegate;
  13. @property (strong, nonatomic, readonly) NSMutableArray *dataArray;
  14. @property (assign, nonatomic, readonly) NSUInteger pageIndex;
  15. @property (nonatomic, copy) void (^reloadView)(NSArray *list); //自定义加载数据方法
  16. @property (assign, nonatomic) BOOL allowShowMore; //是否显示加载更多(默认显示)
  17. @property (assign, nonatomic) BOOL allowShowBlank; //是否显示占位图(默认显示)
  18. @property (assign, nonatomic) BOOL allowShowNoNetworkBlank; //是否显示无网占位图(默认显示)
  19. @property (nullable, strong, nonatomic) NSString *blankImage;
  20. @property (nullable, strong, nonatomic) NSString *blankTitle;
  21. @property (nullable, strong, nonatomic) NSString *blankMessage;
  22. @property (assign, nonatomic) CGFloat offsetY;
  23. //针对个人中心主页 - 后台没有查询出数据时,默认加一条数据标记,此参数目的是为了此时依然展示占位图
  24. @property (assign, nonatomic) BOOL noDataShowBlankByAddFakeDataFlag;
  25. //针对个人中心主页 - 先出现一个暂无数据的空白页,之后才出现正确的空白页
  26. -(void)closeBlankView;
  27. - (void)refreshData;
  28. @end
  29. @protocol GHRefreshCollectionViewDelegate <NSObject>
  30. @required
  31. /**
  32. * @author Jayla, 16-07-21 14:07:11
  33. *
  34. * @brief 上拉加载和下拉刷新回调事件
  35. *
  36. * @param collectionView 当前TableView
  37. * @param pageIndex 加载页号(为0是即为下拉刷新)
  38. * @param success 成功回调(传入当前页数据,页面将自动刷新)
  39. * @param failure 失败回调(传入失败信息,页面将自动提示)
  40. */
  41. - (void)collectionView:(GHRefreshCollectionView *)collectionView
  42. pageIndex:(NSUInteger)pageIndex
  43. offset:(NSInteger)offset
  44. success:(void (^)(NSArray * _Nullable list, BOOL hasNext))success
  45. failure:(void (^)(NSError *error))failure;
  46. @end
  47. NS_ASSUME_NONNULL_END