主要是看 isNotchScreen 的判断方式
1.根据每种设备的屏幕分辨率
// 判断是否是ipad
#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
// 屏幕size
#define kScreenSize (UIScreen.mainScreen.currentMode.size)
// Screen是否有currentMode方法
#define ScreenRespondMode [UIScreen instancesRespondToSelector:@selector(currentMode)]
// 判断设备size是否相等
#define isiPhoneSizeEqual(w, h) (CGSizeEqualToSize(CGSizeMake(w, h), kScreenSize) && !isPad)
// iPhone4(s)
#define kiPhone4 (ScreenRespondMode ? isiPhoneSizeEqual(640, 960) : NO)
// iPhone5(c/s)、SE
#define kiPhone5 (ScreenRespondMode ? isiPhoneSizeEqual(640, 1136) : NO)
// iPhone6(s)、7、8、SE2
#define kiPhone6 (ScreenRespondMode ? isiPhoneSizeEqual(750, 1334) : NO)
// iphone6(s)p、7p、8p (1242, 2208)/(1080, 1920)
#define kiPhone6Plus (ScreenRespondMode ? isiPhoneSizeEqual(1242, 2208) : NO)
// iPhoneX(s)、11Pro
#define kiPhoneX (ScreenRespondMode ? isiPhoneSizeEqual(1125, 2436) : NO)
// iPHoneXr、11
#define kiPhoneXr (ScreenRespondMode ? isiPhoneSizeEqual(828, 1792) : NO)
// iPhoneXs Max、11ProMax
#define kiPhoneXs_Max (ScreenRespondMode ? isiPhoneSizeEqual(1242, 2688) : NO)
// 是否是刘海屏
#define isNotchScreen (kiPhoneX == YES || kiPhoneXr == YES || kiPhoneXs_Max == YES)
#define Height_StatusBar (isNotchScreen ? 44.0 : 20.0)
#define Height_NavBar (isNotchScreen ? 88.0 : 64.0)
#define Height_TabBar (isNotchScreen ? 83.0 : 49.0)
2. 根据屏幕宽高比
// 当前设备的屏幕宽度
#define kScreenWidth (UIScreen.mainScreen.bounds.size.width)
// 当前设备的屏幕高度
#define kScreenHeight (UIScreen.mainScreen.bounds.size.height)
// 是否是 iPhone 设备
#define is_iPhone (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone)
#define kNotchValue ((NSInteger)(kScreenWidth/kScreenHeight*100))
// 是否是iPhone X
#define isNotchScreen (is_iPhone && (kNotchValue == 216 || kNotchValue == 46))
#define zd_lowestVersion(version) ([UIDevice.currentDevice.systemVersion floatValue] > version)
#define zd_statusBarH (( ![UIApplication.sharedApplication isStatusBarHidden] ) ? UIApplication.sharedApplication.statusBarFrame.size.height : (isNotchScreen ? 44.f : 20.f))
/// 导航栏高度
#define zd_navBarH 44.f
/// 标签栏高度
#define kTabBarH 49.f
/// 底部安全高度
#define zd_safeBottomH (zd_lowestVersion(11.0) ? UIApplication.sharedApplication.delegate.window.safeAreaInsets.bottom : 0.f)
/// 状态栏+导航栏 高度
#define zd_statusAndNavbarH (zd_statusBarH + zd_navBarH)
/// 安全标签栏高度
#define zd_tabBarH (kTabBarH + zd_safeBottomH)
3. 根据屏幕宽高的值 是否大于某一个数值
#define kScreenWidth (UIScreen.mainScreen.bounds.size.width)
#define kScreenHeight (UIScreen.mainScreen.bounds.size.height)
#define is_iPhone (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone)
#define isNotchScreen (kScreenWidth >= 375.f && kScreenHeight >= 812.f && is_iPhone)