如何检测Retina HD显示? [英] How to detect Retina HD display?
本文介绍了如何检测Retina HD显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
UIScreen
在iOS 8中有一个新的 nativeScale
属性,但文档不会说一个字。
UIScreen
has a new, nativeScale
property in iOS 8 but the documentation does not say a word about it.
@property(nonatomic, readonly) CGFloat nativeScale
还有一个缩放
属性,但文档说它是2的retina显示。
There is also a scale
property but the docs say it is 2 for retina displays.
@property(nonatomic, readonly) CGFloat scale
$ b b
我想知道是否有办法区分显示。我需要知道设备是否具有Retina HD显示器的原因是因为我想根据显示来请求不同尺寸的图像。
I am wondering if there is a way to distinguish the displays. The reason why I need to know whether the device has Retina HD display is because I want to request images with different sizes based on the displays.
感谢任何帮助! / p>
Thanks for any help!
推荐答案
以下可以非常好地检测iPhone6Plus上的显示类型。
Below works very well to detect type of display on iPhone6Plus.
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 3.0)
NSLog(@"Retina HD");
else
NSLog(@"Non Retina HD");
这篇关于如何检测Retina HD显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文