iOS各设备区别汇总

一、各设备屏幕尺寸

设备 对角线 分辨率(点\1pt=1/72英寸) Scale Factor 分辨率(像素\px) PPI(DPI)
iPhone 4/4s 3.5英寸 320x480 @2x 640x960 326
iPhone 5/5s/5c 4英寸 320x568 @2x 640x1136 326
iPhone 6/7/8 4.7英寸 375x667 @2x 750x1334 326
iPhone 6P/7P/8P 5.5英寸 414x736 @3x 1242x2208(渲染后1080x1920) 401
iPhone X 5.8英寸 375*812 @3x 1125x2436 458

注:Plus设备渲染后像素降低的原因
iPhone Plus的实际PPI是401,理论上苹果应该用401 / 326 x @2x = @2.46x的素材,
但是这个奇葩的臂力对于开发者而言很难切图,
所以苹果为了方便开发者就采用了@3x的素材,然后再缩放到@2.46x的屏幕上,也就是缩放到2.46 / 3 = 83%,
实际上苹果选取了一个接近比例的87%。这样算下来,物理分辨率和虚拟分辨率的比率是87%,也就是1080 / 0.86 = 1242,1920 / 0.87 = 2208。

二、获取各设备名称

#import 

+ (NSString*)deviceModelName
{
    struct utsname systemInfo;
    uname(&systemInfo);
    NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];

    //iPhone 系列
    if ([deviceModel isEqualToString:@"iPhone1,1"])    return @"iPhone 1G";
    if ([deviceModel isEqualToString:@"iPhone1,2"])    return @"iPhone 3G";
    if ([deviceModel isEqualToString:@"iPhone2,1"])    return @"iPhone 3GS";
    if ([deviceModel isEqualToString:@"iPhone3,1"])    return @"iPhone 4";
    if ([deviceModel isEqualToString:@"iPhone3,2"])    return @"Verizon iPhone 4";
    if ([deviceModel isEqualToString:@"iPhone4,1"])    return @"iPhone 4S";
    if ([deviceModel isEqualToString:@"iPhone5,1"])    return @"iPhone 5";
    if ([deviceModel isEqualToString:@"iPhone5,2"])    return @"iPhone 5";
    if ([deviceModel isEqualToString:@"iPhone5,3"])    return @"iPhone 5C";
    if ([deviceModel isEqualToString:@"iPhone5,4"])    return @"iPhone 5C";
    if ([deviceModel isEqualToString:@"iPhone6,1"])    return @"iPhone 5S";
    if ([deviceModel isEqualToString:@"iPhone6,2"])    return @"iPhone 5S";
    if ([deviceModel isEqualToString:@"iPhone7,1"])    return @"iPhone 6 Plus";
    if ([deviceModel isEqualToString:@"iPhone7,2"])    return @"iPhone 6";
    if ([deviceModel isEqualToString:@"iPhone8,1"])    return @"iPhone 6s";
    if ([deviceModel isEqualToString:@"iPhone8,2"])    return @"iPhone 6s Plus";
    if ([deviceModel isEqualToString:@"iPhone9,1"])    return @"iPhone 7 (CDMA)";
    if ([deviceModel isEqualToString:@"iPhone9,3"])    return @"iPhone 7 (GSM)";
    if ([deviceModel isEqualToString:@"iPhone9,2"])    return @"iPhone 7 Plus (CDMA)";
    if ([deviceModel isEqualToString:@"iPhone9,4"])    return @"iPhone 7 Plus (GSM)";
    if([deviceModel isEqualToString:@"iPhone10,1"])     return@"iPhone 8";
    if([deviceModel isEqualToString:@"iPhone10,4"])     return@"iPhone 8";
    if([deviceModel isEqualToString:@"iPhone10,2"])     return@"iPhone 8 Plus";
    if([deviceModel isEqualToString:@"iPhone10,5"])     return@"iPhone 8 Plus";
    if([deviceModel isEqualToString:@"iPhone10,3"])     return@"iPhone X";
    if([deviceModel isEqualToString:@"iPhone10,6"])     return@"iPhone X";
 

    //iPod 系列
    if ([deviceModel isEqualToString:@"iPod1,1"])      return @"iPod Touch 1G";
    if ([deviceModel isEqualToString:@"iPod2,1"])      return @"iPod Touch 2G";
    if ([deviceModel isEqualToString:@"iPod3,1"])      return @"iPod Touch 3G";
    if ([deviceModel isEqualToString:@"iPod4,1"])      return @"iPod Touch 4G";
    if ([deviceModel isEqualToString:@"iPod5,1"])      return @"iPod Touch 5G";

 

    //iPad 系列

    if ([deviceModel isEqualToString:@"iPad1,1"])      return @"iPad";
    if ([deviceModel isEqualToString:@"iPad2,1"])      return @"iPad 2 (WiFi)";
    if ([deviceModel isEqualToString:@"iPad2,2"])      return @"iPad 2 (GSM)";
    if ([deviceModel isEqualToString:@"iPad2,3"])      return @"iPad 2 (CDMA)";
    if ([deviceModel isEqualToString:@"iPad2,4"])      return @"iPad 2 (32nm)";
    if ([deviceModel isEqualToString:@"iPad2,5"])      return @"iPad mini (WiFi)";
    if ([deviceModel isEqualToString:@"iPad2,6"])      return @"iPad mini (GSM)";
    if ([deviceModel isEqualToString:@"iPad2,7"])      return @"iPad mini (CDMA)";
    if ([deviceModel isEqualToString:@"iPad3,1"])      return @"iPad 3(WiFi)";
    if ([deviceModel isEqualToString:@"iPad3,2"])      return @"iPad 3(CDMA)";
    if ([deviceModel isEqualToString:@"iPad3,3"])      return @"iPad 3(4G)";
    if ([deviceModel isEqualToString:@"iPad3,4"])      return @"iPad 4 (WiFi)";
    if ([deviceModel isEqualToString:@"iPad3,5"])      return @"iPad 4 (4G)";
    if ([deviceModel isEqualToString:@"iPad3,6"])      return @"iPad 4 (CDMA)";
    if ([deviceModel isEqualToString:@"iPad4,1"])      return @"iPad Air";
    if ([deviceModel isEqualToString:@"iPad4,2"])      return @"iPad Air";
    if ([deviceModel isEqualToString:@"iPad4,3"])      return @"iPad Air";
    if ([deviceModel isEqualToString:@"iPad5,3"])      return @"iPad Air 2";
    if ([deviceModel isEqualToString:@"iPad5,4"])      return @"iPad Air 2";

    if ([deviceModel isEqualToString:@"iPad4,4"] ||[deviceModel isEqualToString:@"iPad4,5"] ||[deviceModel isEqualToString:@"iPad4,6"])      return @"iPad mini 2";
    if ([deviceModel isEqualToString:@"iPad4,7"] ||[deviceModel isEqualToString:@"iPad4,8"] ||[deviceModel isEqualToString:@"iPad4,9"])      return @"iPad mini 3";

 
    if ([deviceModel isEqualToString:@"i386"])         return @"Simulator";
    if ([deviceModel isEqualToString:@"x86_64"])       return @"Simulator";

    return deviceModel;

}

你可能感兴趣的:(iOS各设备区别汇总)