Nessuna descrizione

FKRefreshControl.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // FKRefreshControl.h
  3. // FirstLink
  4. //
  5. // Created by jack on 15/12/1.
  6. // Copyright © 2015年 FirstLink. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. ///**
  10. // * 当前refreshing状态
  11. // */
  12. //typedef enum {
  13. // FKRefreshingDirectionNone = 0,
  14. // FKRefreshingDirectionTop = 1 << 0,
  15. // FKRefreshingDirectionBottom = 1 << 1
  16. //} FKRefreshingDirections;
  17. //
  18. ///**
  19. // * 指定回调方向
  20. // */
  21. //typedef enum {
  22. // FKRefreshDirectionTop = 0,
  23. // FKRefreshDirectionBottom
  24. //} FKRefreshDirection;
  25. @protocol FKRefreshControlDelegate;
  26. @interface FKRefreshControl : NSObject
  27. ///当前的状态
  28. @property (nonatomic,assign,readonly)RefreshingDirections refreshingDirection;
  29. @property (nonatomic,readonly)UIScrollView * scrollView;
  30. - (instancetype)initWithScrollView:(UIScrollView *)scrollView delegate:(id<FKRefreshControlDelegate>)delegate;
  31. ///是否开启下拉刷新,YES-开启 NO-不开启 默认是NO
  32. @property (nonatomic,assign)BOOL topEnabled;
  33. ///是否开启上拉加载更多,YES-开启 NO-不开启 默认是NO
  34. @property (nonatomic,assign)BOOL bottomEnabled;
  35. ///下拉刷新 状态改变的距离 默认65.0
  36. @property (nonatomic,assign)float enableInsetTop;
  37. ///上拉 状态改变的距离 默认65.0
  38. @property (nonatomic,assign)float enableInsetBottom;
  39. /*
  40. *是否开启自动刷新,下拉到enableInsetTop位置自动刷新
  41. YES-开启,NO-不开启,默认是NO
  42. */
  43. @property (nonatomic,assign)BOOL autoRefreshTop;
  44. /*
  45. * 是否开启自动加载更多,上拉到enableInsetBottom位置自动加载跟多
  46. YES-开启,NO-不开启,默认是NO
  47. */
  48. @property (nonatomic,assign)BOOL autoRefreshBottom;
  49. /**
  50. * 注册Top加载的view,view必须接受RefreshViewDelegate协议,默认是RefreshTopView
  51. * @param topClass 类类型
  52. */
  53. - (void)registerClassForTopView:(Class)topClass;
  54. /**
  55. * 注册Bottom加载的view,view必须接受RefreshViewDelegate协议,默认是RefreshBottomView
  56. * @param bottomClass 类类型
  57. */
  58. - (void)registerClassForBottomView:(Class)bottomClass;
  59. ///开始
  60. - (void)startRefreshingDirection:(RefreshDirection)direction;
  61. ///完成
  62. - (void)finishRefreshingDirection:(RefreshDirection)direction;
  63. @end
  64. /**
  65. * 代理方法
  66. */
  67. @protocol FKRefreshControlDelegate <NSObject>
  68. @optional
  69. - (void)refreshControl:(FKRefreshControl *)refreshControl didEngageRefreshDirection:(RefreshDirection) direction;
  70. @end