IOS获取物理尺寸中7Plus中获取的是7的物理尺寸

时间:2021-08-27 09:23:54

IOS获取物理尺寸中7Plus中获取的是7的物理尺寸:

在开发调试过程中我的7Plus手机获取[uiscreen mainscreen].bounds为750  、1334.

解决方案:在手机中的显示与亮度更改为标准,就可以解决办法。一般情况下都是以物理尺寸来判断手机的启动页和广告的。毕竟如果用

+ (NSString *)iphoneType {

struct utsname systemInfo;

uname(&systemInfo);

NSString *platform = [NSString stringWithCString:systemInfo.machine encoding:NSASCIIStringEncoding];

if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 2G";

if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";

if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";

if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone 4";

if ([platform isEqualToString:@"iPhone3,2"]) return @"iPhone 4";

if ([platform isEqualToString:@"iPhone3,3"]) return @"iPhone 4";

if ([platform isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";

if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone 5";

if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone 5";

if ([platform isEqualToString:@"iPhone5,3"]) return @"iPhone 5c";

if ([platform isEqualToString:@"iPhone5,4"]) return @"iPhone 5c";

if ([platform isEqualToString:@"iPhone6,1"]) return @"iPhone 5s";

if ([platform isEqualToString:@"iPhone6,2"]) return @"iPhone 5s";

if ([platform isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";

if ([platform isEqualToString:@"iPhone7,2"]) return @"iPhone 6";

if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";

if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";

if ([platform isEqualToString:@"iPhone8,4"]) return @"iPhone SE";

if ([platform isEqualToString:@"iPhone9,1"]) return @"iPhone 7";

if ([platform isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";

if ([platform isEqualToString:@"i386"]) return @"iPhone Simulator";

if ([platform isEqualToString:@"x86_64"]) return @"iPhone Simulator";

return platform;

}

 增加手机就要判断。判断会很多、累赘

IOS获取物理尺寸中7Plus中获取的是7的物理尺寸