iPhoneXR底部适配问题 828 1792,750 1624

遇到iPhoneXR屏幕尺寸 828 1792不识别的问题,往下看

iPhoneXR官方的适配尺寸是:828 1792
如下代码所示

#define WYkDevice_Is_iPhoneXr1 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size)  : NO)

但你的项目中 iPhoneXR机型 也许并不识别这个屏幕适配,原因大致就是
1:启动xib的问题
2:缩水屏
3:等等

所以增加一个750, 1624屏幕尺寸即可,如下
(这个尺寸,打印 iPhoneXR 获得)

#define WYkDevice_Is_iPhoneXr2 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1624), [[UIScreen mainScreen] currentMode].size) : NO)

结束

下面是我日常的机型宏,希望对你有所帮助

//机型尺寸判断
//判断是否是ipad
#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
//判断iPhone4系列
#define WYkDevice_Is_iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iPhone5系列
#define WYkDevice_Is_iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iPhone6系列
#define WYkDevice_Is_iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iphone6P系列
#define WYkDevice_Is_iPhone6P ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iPhoneX
#define WYkDevice_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPHoneXr
#define WYkDevice_Is_iPhoneXr1 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
#define WYkDevice_Is_iPhoneXr2 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1624), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs
#define WYkDevice_Is_iPhoneXs ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs Max
#define WYkDevice_Is_iPhoneXsMax ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断是否是iPhoneX系列
#define Is_iPhoneXSeries ((WYkDevice_Is_iPhoneX || WYkDevice_Is_iPhoneXr1 || WYkDevice_Is_iPhoneXr2 || WYkDevice_Is_iPhoneXs ||WYkDevice_Is_iPhoneXsMax) ? YES : NO)

//top高度
#define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
//tabar底部安全区
#define  TAB_Height (Is_iPhoneXSeries ? (49.0+34.0) : 49)
//top顶部安全区
 #define WYKTopHeight (kStatusBarHeight + 44)

你可能感兴趣的:(iPhoneXR底部适配问题 828 1792,750 1624)