计算出来电池条的高度 然后用电池条的高度来判断 ;
// 状态栏(statusbar)
CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
NSLog(@"status width - %f", rectStatus.size.width); // 宽度
NSLog(@"status height - %f", rectStatus.size.height); // 高度
// 导航栏(navigationbar)
CGRect rectNav = self.navigationController.navigationBar.frame;
NSLog(@"nav width - %f", rectNav.size.width); // 宽度
NSLog(@"nav height - %f", rectNav.size.height); // 高度
===============================
//机型
NSString *deviceModel = [[UIDevice currentDevice] model];
XPFLog(@"机型: %@", deviceModel);
//获取设备唯一标识符
NSString *deviceUUID = [[UIDevice currentDevice] identifierForVendor];
XPFLog(@"获取设备唯一标识符: %@", deviceUUID);
//获取系统版本号
NSString *deviceName = [[UIDevice currentDevice] name];
XPFLog(@"获取系统版本号: %@", deviceName);
// 状态栏(statusbar)
CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
NSLog(@"status width - %f", rectStatus.size.width); // 宽度
NSLog(@"status height - %f", rectStatus.size.height); // 高度
// 导航栏(navigationbar)
CGRect rectNav = self.navigationController.navigationBar.frame;
NSLog(@"nav width - %f", rectNav.size.width); // 宽度
NSLog(@"nav height - %f", rectNav.size.height); // 高度
//紅
#define XPF_StatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height //状态栏高度
#define XPF_NavBarHeight 44.0
#define XPF_TabBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height > 20 ? 83 : 49) //底部tabbar高度
#define XPF_TopHeight (XPF_StatusBarHeight + XPF_NavBarHeight) //整个导航栏高度
//适配 tableView
// tableView 偏移20/64适配
if (@available(iOS 11.0, *)) {
self.mainTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;//UIScrollView也适用
}else {
self.automaticallyAdjustsScrollViewInsets = NO;
}