iPhoneXs ,iPhoneXs Max ,iPhoneXr和iPhone X相同点刘海和底部都是一样的,iPhoneXs和iPhone X尺寸一样的,不同点iPhoneXs Max ,iPhoneX屏幕尺寸发生了变化,因为有相同刘海可以归纳iPhone X系列,以前适配iPhone X宏可以不变,只用把判断是否是iPhone X替换成iPhone X系列宏
一.
//判断是否是iPhone X
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125,2436), [[UIScreen mainScreen] currentMode].size) : NO)
// 判断是否是iPhone X系列
#define Device_IS_iPhoneX ({\
BOOL tmp = NO;\
if ([UIScreen instancesRespondToSelector:@selector(currentMode)]) {\
if (CGSizeEqualToSize(CGSizeMake(1125,2436), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(1242,2688), [[UIScreen mainScreen] currentMode].size)|| CGSizeEqualToSize(CGSizeMake(1125,2436), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(828,1792), [[UIScreen mainScreen] currentMode].size)) {\
tmp = YES;\
}else{\
tmp = NO;\
}\
}else{\
tmp = NO;\
}\
tmp;\
})
二.让UI切图iPhone XS Max和iPhone XR
三.打开项目LaunchImage
四.运行项目,适配成功.