判断iOS 设备!
//判断屏幕尺寸(固定的 不可以用这个判断高清) pad是height=1024 width=768
CGSize result = [[UIScreen mainScreen] bounds].size;
//基本和上面的一样
[[UIScreenmainScreen] applicationFrame].size.width
//判断设备是否pad
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{}
//打印设备信息
UIDevice *dev = [UIDevice currentDevice];
NSLog(@"dev.localizedModel==%@",dev.localizedModel);
NSLog(@"dev.systemVersion==%@",dev.systemVersion);
NSLog(@"dev.name===%@",dev.name);
NSLog(@"dev.model===%@",dev.model);
NSLog(@"dev.systemName===%@",dev.systemName);
CGSize aa = [[UIScreen mainScreen] currentMode].size;
//ios 判断当前的设备是那一种型号
NSString *dangqianshebei=[NSString stringWithFormat:@"%@",[[UIScreen mainScreen]preferredM
NSRange this=[dangqianshebei rangeOfString:@"2048"];
if (this.location != NSNotFound) {
NSLog(@"ipad3");
}else {
this=[dangqianshebei rangeOfString:@"1024"];
if (this.location != NSNotFound) {
NSLog(@"ipad2");
}else {
this=[dangqianshebei rangeOfString:@"960"];
if (this.location != NSNotFound) {
NSLog(@"iphone高清");
}else {
this=[dangqianshebei rangeOfString:@"480"];
if (this.location != NSNotFound) {
NSLog(@"iphone小屏");
}else {
NSLog(@"其他");
}
}
}
}
设备 尺寸 分辨率 ppi 宽高比
ipad 2 9.7 1024x768 132
iPad 4 9.7 2048x1536 264 4:3
iPad 3 9.7 2048x1536 264 4:3
iphone 3g 3.5 480x320 163
iPhone 5 4.0 1136x640 326 16:9
iPhone 4,4S 3.5 960x640 326 3:2
iPod Touch5 4.0 1136x640 326 16:9
iPod Touch4 3.5 960x640 326 3:2
//判断设备版本号
[[[UIDevice currentDevice] systemVersion] floatValue]
//判断iphone是否高清
//scale = 1低清 为2是高清
[UIScreenmainScreen].scale = 1;
//判断ipad是否高清用
[[UIScreenmainScreen] currentMode].size
高清的width=2048 height=1536
低清的width=1024 height=768
//宏定义判断是否是高清ipad
#define isRetinaPad ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1536, 2048), [[UIScreen mainScreen] currentMode].size) : NO)

浙公网安备 33010602011771号