//获得屏幕的宽高
#define kScreenWidth ([UIScreen mainScreen].bounds.size.width)
#define kScreenHeight ([UIScreen mainScreen].bounds.size.height)
//iPhoneX / iPhoneXS
#define isIphoneX_XS ((MIN(kScreenWidth, kScreenHeight) == 375.f) && (MAX(kScreenWidth, kScreenHeight)) == 812.f ? YES : NO)
//iPhoneXR / iPhoneXSMax
#define isIphoneXR_XSMax ((MIN(kScreenWidth, kScreenHeight) == 414.f) && (MAX(kScreenWidth, kScreenHeight) == 896.f) ? YES : NO)
//异形全面屏
#define isSpecialFullScreenScreen (isIphoneX_XS || isIphoneXR_XSMax)
// Status bar height.
#define StatusBarHeight (isSpecialFullScreenScreen ? 44.f : 20.f)
// Navigation bar height.
#define NavigationBarHeight 44.f
// Tabbar height.
#define TabbarHeight (isSpecialFullScreenScreen ? (49.f+34.f) : 49.f)
// Tabbar safe bottom margin.
#define TabbarSafeBottomMargin (isSpecialFullScreenScreen ? 34.f : 0.f)
// Status bar & navigation bar height.
#define StatusBarAndNavigationBarHeight (isSpecialFullScreenScreen ? 88.f : 64.f)
iPhone屏幕适配常用宏
最新推荐文章于 2024-06-08 03:29:10 发布