悟空记账

HCPopupCommon.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // HCPopupCommon.h
  3. // Test2
  4. //
  5. // Created by hehaichi on 2017/12/15.
  6. // Copyright © 2017年 hehaichi. All rights reserved.
  7. //
  8. #ifndef HCPopupCommon_h
  9. #define HCPopupCommon_h
  10. typedef NS_ENUM(NSInteger, HCBasePopupAnimatingType) {
  11. HCBasePopupAnimatingTypePresent = 1,
  12. HCBasePopupAnimatingTypeDismiss = 2,
  13. };
  14. #pragma mark - Function
  15. #define CWIPColorFromHex(rgbValue) [UIColor colorWithRed:((float)(((rgbValue) & 0xFF0000) >> 16))/255.0 green:((float)(((rgbValue) & 0xFF00) >> 8))/255.0 blue:((float)((rgbValue) & 0xFF))/255.0 alpha:1.0]
  16. #define CWIPRandom(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)/255.0]
  17. #define CWIPRandomColor CWIPRandom(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))
  18. #define CWIPScreenHeight ([UIScreen mainScreen].bounds.size.height)
  19. #define CWIPScreenWidth ([UIScreen mainScreen].bounds.size.width)
  20. #define CWIPlocalString(keyName) (NSLocalizedStringFromTable(keyName,@"CWIPLocalizable",nil))
  21. #define CWIPRectLog(imageContainerRect) NSLog(@"x:%lf,y:%lf,w:%lf,h:%lf",imageContainerRect.origin.x,imageContainerRect.origin.y,imageContainerRect.size.width,imageContainerRect.size.height);
  22. #define CWIPPointLogi(point) NSLog(@"x:%lf,y:%lf",point.x,point.y);
  23. #define CWIPSizeLog(asize) NSLog(@"w:%lf,h:%lf",asize.width,asize,height);
  24. #define CWIPDarkColor CWIPColorFromHex(0x2b2c37)
  25. #define CWIPGreenColor CWIPColorFromHex(0x1bac19)
  26. #pragma mark - Const
  27. #define kCWIPThumbnailEdge 4
  28. #define kCWIPThumbnailNumberOfRow 4
  29. #define kCWIPThumbnailSelectdButtonLength 30
  30. #pragma mark - Block Weak self
  31. #if __has_include(<ReactiveCocoa/ReactiveCocoa.h>)
  32. #import <ReactiveCocoa/ReactiveCocoa.h>
  33. #ifndef spweakify
  34. #define spweakify(...) @weakify(__VA_ARGS__)
  35. #endif
  36. #ifndef spstrongify
  37. #define spstrongify(...) @strongify(__VA_ARGS__)
  38. #endif
  39. #else
  40. #ifndef spweakify
  41. #if DEBUG
  42. #define spweakify(object) @autoreleasepool{} __weak __typeof__(object) weak##_##object = object
  43. #else
  44. #define spweakify(object) @try{} @finally{} {} __weak __typeof__(object) weak##_##object = object
  45. #endif
  46. #endif
  47. #ifndef spstrongify
  48. #if DEBUG
  49. #define spstrongify(object) @autoreleasepool{} __typeof__(object) object = weak##_##object
  50. #else
  51. #define spstrongify(object) @try{} @finally{} __typeof__(object) object = weak##_##object
  52. #endif
  53. #endif
  54. #endif
  55. #endif /* HCPopupCommon_h */