XG_PickerMacro.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // Macro.h
  3. // MyApp
  4. //
  5. // Created by huxinguang on 2018/9/10.
  6. // Copyright © 2018年 huxinguang. All rights reserved.
  7. //
  8. #ifndef Macro_h
  9. #define Macro_h
  10. //=========================================通用宏==============================================
  11. #define kAppScreenWidth ([UIScreen mainScreen].bounds.size.width)//屏幕宽度
  12. #define kAppScreenHeight ([UIScreen mainScreen].bounds.size.height)//屏幕高度
  13. #define IS_Pad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) //判断是否是ipad
  14. #define IS_iPhoneX_Or_Xs ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)//判断是否iPhone X/Xs
  15. #define IS_iPhoneXr ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !IS_Pad : NO)//判断iPHoneXr
  16. #define IS_iPhoneXs_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !IS_Pad : NO)//判断iPhoneXs Max
  17. #define IS_X_Series (IS_iPhoneX_Or_Xs || IS_iPhoneXr || IS_iPhoneXs_Max) //判断是否为带刘海的iPhone
  18. #define kAppStatusBarHeight ((IS_iPhoneX_Or_Xs || IS_iPhoneXr || IS_iPhoneXs_Max) ? 44.f : 20.f) //状态栏高度
  19. #define kAppNavigationBarHeight 44.f //导航栏高度(不包含状态栏).
  20. #define kAppTabbarHeight ((IS_iPhoneX_Or_Xs || IS_iPhoneXr || IS_iPhoneXs_Max) ? (49.f+34.f) : 49.f)// Tabbar 高度.
  21. #define kAppTabbarSafeBottomMargin ((IS_iPhoneX_Or_Xs || IS_iPhoneXr || IS_iPhoneXs_Max) ? 34.f : 0.f)// Tabbar 底部安全高度.
  22. #define kAppStatusBarAndNavigationBarHeight ((IS_iPhoneX_Or_Xs || IS_iPhoneXr || IS_iPhoneXs_Max) ? 88.f : 64.f)// 状态栏和导航栏总高度.
  23. #define ImageWithFile(_pointer) [UIImage imageWithContentsOfFile:[[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"AssetPicker" ofType:@"bundle"]] pathForResource:[NSString stringWithFormat:@"%@@%dx",_pointer,(int)[UIScreen mainScreen].nativeScale] ofType:@"png"]]
  24. #define kShowStatusBarNotification @"ShowStatusBarNotification"
  25. #define kNavigationBarImageViewTag 111
  26. #ifndef weakify
  27. #if DEBUG
  28. #if __has_feature(objc_arc)
  29. #define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
  30. #else
  31. #define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
  32. #endif
  33. #else
  34. #if __has_feature(objc_arc)
  35. #define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
  36. #else
  37. #define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
  38. #endif
  39. #endif
  40. #endif
  41. #ifndef strongify
  42. #if DEBUG
  43. #if __has_feature(objc_arc)
  44. #define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
  45. #else
  46. #define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
  47. #endif
  48. #else
  49. #if __has_feature(objc_arc)
  50. #define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
  51. #else
  52. #define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
  53. #endif
  54. #endif
  55. #endif
  56. //=========================================导航栏(自定义部分)=====================================
  57. #define kAppNavigationTitleViewTitleFontSize 16
  58. #define kAppNavigationTitleViewMaxWidth 220.f
  59. #define kAppNavigationTitleViewHeight 44.f
  60. //===========================================颜色===============================================
  61. #define kAppThemeColor [UIColor colorWithRed:62/255.0 green:122/255.0 blue:242/255.0 alpha:1.0] //app主题色 0x24A0FC
  62. #define kAppNavigationTopPageTitleColor [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0] //一级页面导航栏标题颜色
  63. #endif /* Macro_h */