AppDef.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // AppDef.h
  3. // Zhuawawa
  4. //
  5. // Created by 曹福涛 on 2017/11/29.
  6. // Copyright © 2017年 kennethmiao. All rights reserved.
  7. //
  8. #ifndef AppDef_h
  9. #define AppDef_h
  10. #import <UIKit/UIKit.h>
  11. #import <AdSupport/AdSupport.h>
  12. #define PageSize 20 //接口分页pagesize
  13. #define REQUEST_FAIL @"请求失败"
  14. #define BASE_API @"http://test.ttdj.ttdianjing.com"
  15. #define VIP_API_WITH(var) [BASE_API stringByAppendingString:var]
  16. #define QUERY_USER_VIP VIP_API_WITH(@"/user/queryUserVip")
  17. #define VIP_GRADE_LIST VIP_API_WITH(@"/user/vipList")
  18. #pragma mark - 尺寸
  19. #define kScreen_width [UIScreen mainScreen].bounds.size.width
  20. #define kScreen_height [UIScreen mainScreen].bounds.size.height
  21. #define NAVBAR_HEIGHT 44
  22. #define CELL_HEIGHT 49
  23. #define TABBAR_HEIGHT (IS_IPHONEX ? 83:49)
  24. #define STATUSBAR_HEIGHT [[UIApplication sharedApplication] statusBarFrame].size.height
  25. #define NAV_HEIGHT (NAVBAR_HEIGHT+STATUSBAR_HEIGHT)
  26. #define H_10 10.f
  27. #define H_15 15.f
  28. #define H_20 20.f
  29. #define H_25 25.f
  30. #define H_30 30.f
  31. #define H_40 40.f
  32. #pragma mark - 设备
  33. #define IS_IPHONE4 (([[UIScreen mainScreen] bounds].size.height-480)?NO:YES)
  34. #define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES)
  35. #define IS_IPHONE6 (([[UIScreen mainScreen] bounds].size.height-667)?NO:YES)
  36. #define IS_IPHONE6P (([[UIScreen mainScreen] bounds].size.height-736)?NO:YES)
  37. #define IS_IPHONEX ([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.height == 896)
  38. //#define IS_IPHONEX \
  39. //({BOOL isPhoneX = NO;\
  40. //if (@available(iOS 11.0, *)) {\
  41. //isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
  42. //}\
  43. //(isPhoneX);})
  44. #define SAFEAREA_BOTTOMHEIGHT (IS_IPHONEX?34.f:0.f)
  45. #pragma mark - 字体
  46. #define FONT_10 [UIFont systemFontOfSize:10]
  47. #define FONT_11 [UIFont systemFontOfSize:11]
  48. #define FONT_12 [UIFont systemFontOfSize:12]
  49. #define FONT_13 [UIFont systemFontOfSize:13]
  50. #define FONT_14 [UIFont systemFontOfSize:14]
  51. #define FONT_15 [UIFont systemFontOfSize:15]
  52. #define FONT_16 [UIFont systemFontOfSize:16]
  53. #define FONT_17 [UIFont systemFontOfSize:17]
  54. #define FONT_18 [UIFont systemFontOfSize:18]
  55. #define FONT_20 [UIFont systemFontOfSize:20]
  56. #define FONT_21 [UIFont systemFontOfSize:21]
  57. #define FONT_22 [UIFont systemFontOfSize:22]
  58. #define FONT_24 [UIFont systemFontOfSize:24]
  59. #define FONT_40 [UIFont systemFontOfSize:40]
  60. #pragma mark - 颜色
  61. #define RGBACOLOR(r, g, b, a) [UIColor colorWithRed : (r) / 255.0f green : (g) / 255.0f blue : (b) / 255.0f alpha : (a)]
  62. #define COLOR_D1A956 HexColor(@"D1A956")
  63. #define COLOR_8F8F8F HexColor(@"8F8F8F")
  64. #define COLOR_FEE1B3 HexColor(@"FEE1B3")
  65. #define COLOR_1A1A1A HexColor(@"1A1A1A")
  66. #define COLOR_E6 HexColor(@"E6E6E6")
  67. #define COLOR_3EC6FF HexColor(@"3EC6FF")
  68. #define COLOR_167DE7 HexColor(@"167DE7")
  69. #define COLOR_DEDEDE HexColor(@"DEDEDE")
  70. #define COLOR_F5F5F5 HexColor(@"F5F5F5")
  71. #define COLOR_212121 HexColor(@"212121")
  72. NS_INLINE UIColor* HexColor(NSString *inColorString) {
  73. UIColor *result = nil;
  74. unsigned int colorCode = 0;
  75. unsigned char redByte, greenByte, blueByte;
  76. if (nil != inColorString) {
  77. NSScanner *scanner = [NSScanner scannerWithString:inColorString];
  78. (void)[scanner scanHexInt:&colorCode]; // ignore error
  79. }
  80. redByte = (unsigned char)(colorCode >> 16);
  81. greenByte = (unsigned char)(colorCode >> 8);
  82. blueByte = (unsigned char)(colorCode); // masks off high bits
  83. result = [UIColor
  84. colorWithRed:(float)redByte / 0xff
  85. green:(float)greenByte / 0xff
  86. blue:(float)blueByte / 0xff
  87. alpha:1.0];
  88. return result;
  89. }
  90. #endif /* AppDef_h */