TTCCom.h 1.3 KB

12345678910111213141516171819202122232425262728
  1. //
  2. // TTCCom.h
  3. // tttt
  4. //
  5. // Created by 唐天成 on 2021/8/9.
  6. //
  7. #ifndef TTCCom_h
  8. #define TTCCom_h
  9. #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
  10. #define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
  11. // 颜色值RGB
  12. #define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
  13. #define RGBCOLORVALUE(rgb) ([UIColor colorWithRed:(float)((rgb & 0xFF0000) >> 16)/255.0 green:(float)((rgb & 0x00FF00) >> 8)/255.0 blue:(float)((rgb & 0x0000FF))/255.0 alpha:1.0])
  14. //是否是iPhoneX
  15. #define kDevice_Is_iPhoneX (@available(iOS 11.0, *) ? ([UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom ? YES : NO) : NO)
  16. //导航条的高度
  17. #define NavigationHeight (kDevice_Is_iPhoneX ? 88 : 64)
  18. #define SafeAreaBottomHeight (@available(iOS 11.0, *) ? [UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom : 0)
  19. #define SafeAreaTopHeight (@available(iOS 11.0, *) ? [UIApplication sharedApplication].keyWindow.safeAreaInsets.top : 0)
  20. #define SafeAreaLeftHeight (@available(iOS 11.0, *) ? [UIApplication sharedApplication].keyWindow.safeAreaInsets.left : 0)
  21. #define SafeAreaRightHeight (@available(iOS 11.0, *) ? [UIApplication sharedApplication].keyWindow.safeAreaInsets.right : 0)
  22. #endif /* TTCCom_h */