整理 iPhone x 适配 笔记

计算出来电池条的高度 然后用电池条的高度来判断 ;

// 状态栏(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;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1、禁止手机睡眠 [UIApplication sharedApplication].idleTimerDisab...
    FF_911阅读 1,423评论 0 3
  • 1、禁止手机睡眠[UIApplication sharedApplication].idleTimerDisabl...
    DingGa阅读 1,141评论 1 6
  • 1.NSTimer //暂停if ([timer isValid]) {[timer setFireDate:[N...
    俊月阅读 1,363评论 0 0
  • 人生中出现的一切,都无法占有,只能经历。我们只是时间的过客,总有一天,我们会和所有的一切永别。深知这一点的人,就会...
    海盗lucifer阅读 171评论 0 0
  • 我的神,明天要和老板对班,人都不好了,她们全急性子,急得要命,还催我,但我只追求效率,至于速度,其次啦,烦死了,没...
    1大太阳阅读 465评论 0 1