MJRefreshConst.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // 代码地址: https://github.com/CoderMJLee/MJRefresh
  2. // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
  3. #import <UIKit/UIKit.h>
  4. #import <objc/message.h>
  5. // 弱引用
  6. #define MJWeakSelf __weak typeof(self) weakSelf = self;
  7. // 日志输出
  8. #ifdef DEBUG
  9. #define MJRefreshLog(...) NSLog(__VA_ARGS__)
  10. #else
  11. #define MJRefreshLog(...)
  12. #endif
  13. // 过期提醒
  14. #define MJRefreshDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead)
  15. // 运行时objc_msgSend
  16. #define MJRefreshMsgSend(...) ((void (*)(void *, SEL, UIView *))objc_msgSend)(__VA_ARGS__)
  17. #define MJRefreshMsgTarget(target) (__bridge void *)(target)
  18. // RGB颜色
  19. #define MJRefreshColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
  20. // 文字颜色
  21. #define MJRefreshLabelTextColor MJRefreshColor(90, 90, 90)
  22. // 字体大小
  23. #define MJRefreshLabelFont [UIFont boldSystemFontOfSize:14]
  24. // 图片路径
  25. #define MJRefreshSrcName(file) [@"MJRefresh.bundle" stringByAppendingPathComponent:file]
  26. #define MJRefreshFrameworkSrcName(file) [@"Frameworks/MJRefresh.framework/MJRefresh.bundle" stringByAppendingPathComponent:file]
  27. // 常量
  28. UIKIT_EXTERN const CGFloat MJRefreshHeaderHeight;
  29. UIKIT_EXTERN const CGFloat MJRefreshFooterHeight;
  30. UIKIT_EXTERN const CGFloat MJRefreshFastAnimationDuration;
  31. UIKIT_EXTERN const CGFloat MJRefreshSlowAnimationDuration;
  32. UIKIT_EXTERN NSString *const MJRefreshKeyPathContentOffset;
  33. UIKIT_EXTERN NSString *const MJRefreshKeyPathContentSize;
  34. UIKIT_EXTERN NSString *const MJRefreshKeyPathContentInset;
  35. UIKIT_EXTERN NSString *const MJRefreshKeyPathPanState;
  36. UIKIT_EXTERN NSString *const MJRefreshHeaderLastUpdatedTimeKey;
  37. UIKIT_EXTERN NSString *const MJRefreshHeaderIdleText;
  38. UIKIT_EXTERN NSString *const MJRefreshHeaderPullingText;
  39. UIKIT_EXTERN NSString *const MJRefreshHeaderRefreshingText;
  40. UIKIT_EXTERN NSString *const MJRefreshAutoFooterIdleText;
  41. UIKIT_EXTERN NSString *const MJRefreshAutoFooterRefreshingText;
  42. UIKIT_EXTERN NSString *const MJRefreshAutoFooterNoMoreDataText;
  43. UIKIT_EXTERN NSString *const MJRefreshBackFooterIdleText;
  44. UIKIT_EXTERN NSString *const MJRefreshBackFooterPullingText;
  45. UIKIT_EXTERN NSString *const MJRefreshBackFooterRefreshingText;
  46. UIKIT_EXTERN NSString *const MJRefreshBackFooterNoMoreDataText;
  47. // 状态检查
  48. #define MJRefreshCheckState \
  49. MJRefreshState oldState = self.state; \
  50. if (state == oldState) return; \
  51. [super setState:state];