目前采用的适配方案
#define kStatusBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height)
#define kIS_IPHONE_X (kStatusBarHeight > 20.0f)
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhoneXS_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)
关于屏幕分辨率
image.png来个详细的
iphone手机对比20181026.png+ (BOOL)isIPhoneX {
return ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO);
}
这么判断的需要修改啦
关于启动图
启动图尺寸 机型 命名
640 × 960 iPhone4s Default@2x
640 × 1136 iPhone5s Default-568h@2x
750 × 1334 iPhone Default-667h@2x
1242 × 2208 iPhonePlus Default-736h@3x
1125 × 2436 iPhoneX, XS Default-812h@3x
828 x 1792 iPhoneXR Default-828h@2x
1242 x 2688 iPhoneX Max Default-1242h@3x
网友评论