iPhone劉海屏系列適配判斷
///MARK:? iPhone X 劉海屏系列宏定義判斷(適用目前所有的iPhone劉海屏)
#define IPHONE_X? \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})
安全距離
/// iPhone X 系列 頂部適配
//statusBar Height
#define kStatusBarHeight? ? (IPHONE_X ? 44.f : 20.f)
//nav Height
#define kTopNavHeight? ? (kStatusBarHeight + 44.f)
/// iPhone X 系列底部適配
//底部安全距離
#define kSafeAreaBottomHeight? (IPHONE_X ? 34.f : 0.f)
//TabBar Height
#define kBottomTabBarHeight? ? (kSafeAreaBottomHeight + 49.f)