iOS屏幕分辨率判断

判断 iPhone5的

define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

iPhone6和iPhone7有放大模式,开启放大模式后,手机分辨率会发生变化,iPhone6的会变成iPhone5的分辨率,如果进行屏幕适配,可以按照iPhone5的屏幕适配放大模式的iPhone6.

define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) : NO)

iPhone6P和iPhone7P,开启放大模式后,分辨率不会降到iPhone6的大小,所以可以单独适配

define iPhone6plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size)) : NO)

你可能感兴趣的:(iOS屏幕分辨率判断)