美文网首页
每周学习总结(iphone x适配

每周学习总结(iphone x适配

作者: 我是世界微小的存在 | 来源:发表于2017-10-18 17:07 被阅读0次

1.打包给测试不需要上架并发布在蒲公英上的app快速方法:编译项目(command+B)->products(项目show in finder)将其拖到桌面 ,新建一个命名为Payload的文件夹,将项目放里面压缩,改后缀为.ipa发布即可

2.iphone x适配

(1)增加启动图像素为 1125*2436,适配屏幕尺寸

111.png

(2)定义iphone x宏定义

// 判断是否是iPhone X
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
// 状态栏高度
#define HEIGHT_STATUS_BAR (iPhoneX ? 44.f : 20.f)
// 导航栏高度
#define HEIGHT_NAV_STATUS_BAR (iPhoneX ? 88.f : 64.f)
// tabBar高度
#define HEIGHT_TAB_BAR (iPhoneX ? (49.f+34.f) : 49.f)
// home indicator
#define HOME_INDICATOR_HEIGHT (iPhoneX ? 34.f : 0.f)
#define SEARCH_HEIGHT (iPhoneX ? 44.f : 20.f)

(3)tableView cell高度问题和头视图尾视图会有很大间隙,解决办法:


self.tableView.estimatedRowHeight = 0;

self.tableView.estimatedSectionHeaderHeight = 0;

self.tableView.estimatedSectionFooterHeight = 0;

(4)如果使用了Masonry进行布局,就要适配safeArea

if ([UIDevice currentDevice].systemVersion.floatValue >= 11.0) {
    make.edges.equalTo(self.view.safeAreaInsets);
} else {
    make.edges.equalTo(self.view);
}

相关文章

网友评论

      本文标题: 每周学习总结(iphone x适配

      本文链接:https://www.haomeiwen.com/subject/eyeeuxtx.html