参考:https://www.cnblogs.com/apiapia/p/9710703.html
https://blog.csdn.net/qq_33608748/article/details/82769570
1、XR使用的@2x
2、 iPhoneXR、X Max 尺寸
828 x 1792 iPhoneXR Default-828h@2x
1242 x 2688 iPhoneX Max Default-1242h@3x
3、适配有些比较大的控件,产品会要求按照屏幕比例进行调整,小屏幕的显示的小一点,大屏幕的显示大一点,这个也是两个宏搞定
#define kScaleH (kScreenHeight/667.0)
#define kScaleW (kScreenWidth/375.0)
解释一下为什么除的667和375,因为UI给的设计图示按照667 * 375的屏幕给的
4、怎么判断是不是iPhone X? 获取当前屏幕宽度或高度与尺寸进行比较就可以了
#define kNavBarHeight (iphoneX ? 88.0 : 64.0)
#define kBottomBarHeight (iphoneX ? 34.0 : 0)
#define kContentHeight (kScreenHeight - kNavBarHeight-kBottomBarHeight)
5、代码区分4系列、5、plus、iPhoneX的宏定义
#define DEVICE_IS_IPHONE4 ([[UIScreen mainScreen] bounds].size.height ==480) + +width 320
#define DEVICE_IS_IPHONE5 ([[UIScreen mainScreen] bounds].size.height ==568) +width 320
#define DEVICE_IS_IPHONE6 ([[UIScreen mainScreen] bounds].size.height ==667) +width 375
#define DEVICE_IS_IPHONE6P ([[UIScreen mainScreen] bounds].size.height ==736) + width 414
#define DEVICE_IS_IPHONEX ([[UIScreen mainScreen] bounds].size.height ==812) + width 375
#define DEVICE_IS_IPHONEX_MAX ([[UIScreen mainScreen] bounds].size.height ==896) + width 414
#define StausBar_H (SCREEN_HEIGHT ==812? 44:20)
#define SafeAreaBottom_H (SCREEN_HEIGHT ==812?34:0)
#define iphoneX ([UIScreen mainScreen].bounds.size.height ==812?1:0)
参考:https://blog.csdn.net/a18339063397/article/details/81482073
6、iPhone上按比例适配
#define ratio Screen_Width/375.0
7、屏幕适配
参考:https://www.jianshu.com/p/5e171975225a