如何在iOS中查看iPhone设备版本? [英] How to check iPhone Device Version in iOS?
本文介绍了如何在iOS中查看iPhone设备版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我想在iOS上查看iPhone设备版本。
Hi i would like to check iPhone Device Version in iOS.
我的意思是,目前正在运行的设备是iPhone 4或iPhone 5.
I mean , currently running device is iPhone 4 or iPhone 5.
我需要检查设备,是不是iPhone 5?
I need to check the device , is that iPhone 5 or not?
因为我的应用程序中有一些问题需要知道iPhone 5或不。
Because i have some problem in my app that need to know iPhone 5 or not.
那我该怎么办?
推荐答案
添加此代码:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
if ([[UIScreen mainScreen] respondsToSelector: @selector(scale)]) {
CGSize result = [[UIScreen mainScreen] bounds].size;
CGFloat scale = [UIScreen mainScreen].scale;
result = CGSizeMake(result.width * scale, result.height * scale);
if(result.height == 960) {
NSLog(@"iPhone 4 Resolution");
resolution_number = 1;
}
if(result.height == 1136) {
NSLog(@"iPhone 5 Resolution");
}
}
else{
NSLog(@"Standard Resolution");
}
}
这篇关于如何在iOS中查看iPhone设备版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文