iOS

iPhone ScreenSize & FontSize

2019-05-21  本文已影响0人  ienos

分辨率

设备 尺寸(寸) (横向 * 纵向), 逻辑分辨率 分辨率的倍数 物理分辨率
iPhone 4s 3.5 320 * 480 2x 640 * 960
iPhone 5s 4.0 320 * 568 2x 640 *1136
iPhone 6s/6/7/8 4.7 375 * 667 2x 750 * 1334
iPhone 6sp/6p/7p/8p 5.5 414 * 736 3x 1080 * 1920
iPhone X/XS 5.8 375 * 812 3x 1125x2436
iPhone XR 6.1 414 * 896 3x 828 *1792
iPhone XS Max 6.8 414 * 896 3x 1242 * 2688

ppi --- pixel per inch

每寸有多少个像素;当 ppi > 300pi 时,人眼就不能区分出每一个像素

iOS 字体大小

兼容模式 & 高清模式

兼容模式,大屏幕一切按照 320 Point 渲染(删除 LaunchImage)

LaunchImage

image.png

Appicon Size

40 / 60 / 80 / 58 / 87 / 120 / 180 / 1024(直角 alpha 否)

Get Device Type Name

#import <sys/utsname.h>

- (NSString *)deviceIdentify {
    static NSString *d_identify;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        struct utsname systemInfo;
        uname(&systemInfo);
        d_identify = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
    });
    return d_identify;
}

- (NSString *)deviceName {
    static NSString *deviceName;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSString *identify = [self deviceIdentify];
        if (!identify) return ;
        NSDictionary *deviceMap = @{
                                        // iPhone
                                        @"iPhone1,1" : @"iPhone",
                                       
                                        //Simulator
                                        @"i386" : @"Simulator x86",
                                        @"x86_64" : @"Simulator x64",
                                        };
        deviceName = deviceMap[identify];
        if (!deviceName) deviceName = identify;
    });
    return deviceName;
}

可以将需要的设备机型补充至 deviceMap,对照表查询方式如下:

Device Device Identify
iPhone 3G iPhone1,2
iPhone 3GS iPhone2,1
iPhone 4 iPhone3,1
iPhone 4 iPhone3,2
iPhone 4 iPhone3,3
iPhone 4S iPhone4,1
iPhone 5 iPhone5,1
iPhone 5 iPhone5,2
iPhone 5c iPhone5,3
iPhone 5c iPhone5,4
iPhone 5s iPhone6,1
iPhone 5s iPhone6,2
iPhone 6 iPhone7,2
iPhone 6 Plus iPhone7,1
iPhone 6s iPhone8,1
iPhone 6s Plus iPhone8,2
iPhone SE iPhone8,4
iPhone 7 iPhone9,1
iPhone 7 iPhone9,3
iPhone 7 Plus iPhone9,2
iPhone 7 Plus iPhone9,4
iPhone 8 iPhone10,1
iPhone 8 iPhone10,4
iPhone 8 Plus iPhone10,2
iPhone 8 Plus iPhone10,5
iPhone X iPhone10,3
iPhone X iPhone10,6
iPhone XR iPhone11,8
iPhone XS iPhone11,2
iPhone XS Max iPhone11,6
iPhone XS Max iPhone11,4
iPhone 11 iPhone12,1
iPhone 11 Pro iPhone12,3
iPhone 11 Pro Max iPhone12,5
iPhone SE (2nd generation) iPhone12,8
上一篇下一篇

猜你喜欢

热点阅读