Common.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // Common.h
  3. // Demo
  4. //
  5. // Created by cindy on 2020/5/29.
  6. // Copyright © 2020 Seqster. All rights reserved.
  7. //
  8. #ifndef Common_h
  9. #define Common_h
  10. #import "UIColor+expanded.h"
  11. #import "UIViewExt.h"
  12. //取得屏幕的宽、高
  13. #define kScreenWidth [UIScreen mainScreen].bounds.size.width
  14. #define kScreenHeight [UIScreen mainScreen].bounds.size.height
  15. //获取图片资源
  16. #define JXGetImage(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]
  17. /*** 粗体 */
  18. #define kBoldFont(size) [UIFont boldSystemFontOfSize:size]
  19. /*** 普通字体 */
  20. #define kFont(size) [UIFont systemFontOfSize:size]
  21. #define RGBColor(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
  22. #define UIColorHex(_hex_) [UIColor colorWithHexString:((__bridge NSString *)CFSTR(#_hex_))]
  23. #define kBlackColor [UIColor blackColor]
  24. #define kDarkGrayColor [UIColor darkGrayColor]
  25. #define kLightGrayColor [UIColor lightGrayColor]
  26. #define kWhiteColor [UIColor whiteColor]
  27. #define kGrayColor [UIColor grayColor]
  28. #define kRedColor [UIColor redColor]
  29. #define kGreenColor [UIColor greenColor]
  30. #define kBlueColor [UIColor blueColor]
  31. #define kCyanColor [UIColor cyanColor]
  32. #define kYellowColor [UIColor yellowColor]
  33. #define kMagentaColor [UIColor magentaColor]
  34. #define kOrangeColor [UIColor orangeColor]
  35. #define kPurpleColor [UIColor purpleColor]
  36. #define kClearColor [UIColor clearColor]
  37. // iPhone X系列(X和XS是一样的宽高,XR和XMAX是一样的,刘海的status和底部的34跟X是一致的
  38. #define XS_iPhoneX ((kScreenWidth == 375.f && kScreenHeight == 812.f ? YES : NO)||(kScreenWidth == 812.f && kScreenHeight == 375.f ? YES : NO)|| (kScreenWidth == 414.f && kScreenHeight == 896.f ? YES : NO)|| (kScreenWidth == 896.f && kScreenHeight == 414.f ? YES : NO))
  39. // Tabbar height.
  40. #define XS_TabbarHeight (XS_iPhoneX ? (49.f+34.f) : 49.f)
  41. // Tabbar safe bottom margin.
  42. #define XS_TabbarSafeBottomMargin (XS_iPhoneX ? 34.f : 0.f)
  43. #define XS_StatusBarAndNavigationBarHeight (XS_iPhoneX ? 88.f : 64.f)
  44. #endif /* Common_h */