1.状态栏
#define KSTA_H [[UIApplication sharedApplication] statusBarFrame].size.height
2.导航栏
#define KNAV_H (KSTA_H + 44)
3.标签栏 先获取安全距离在加上标签栏高度
//获取底部安全距离 + (CGFloat)safeAreaHeight { if (@available(iOS 11.0, *)) { UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window]; return mainWindow.safeAreaInsets.bottom; } return 0; }
#define KTAB_H ([Tool safeAreaHeight] + 49)
4.全面屏机型判断
+(BOOL)isFullScreenIphone { BOOL isFullIphone = NO; if (@available(iOS 11.0, *)) { UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window]; if (mainWindow.safeAreaInsets.bottom > 0.0) { isFullIphone = YES; } } return isFullIphone; }