Possible Duplicate:
Detect Retina Display
How can we know if a device has a retina display or not from objective C code?
Possible Duplicate:
Detect Retina Display
How can we know if a device has a retina display or not from objective C code?
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]
&& [[UIScreen mainScreen] scale] >= 2.0) {
// Retina
} else {
// Not Retina
}
You can check the scale
property on [UIScreen mainScreen]
if it is 2.0 you are running on retina, if it is 1.0 you are not. You can also get the scale from the current CoreGraphics Context.
I don't think you can determine that directly. You'll have to infer it from the model information you can get back from sysctlbyname (see the iOS man pages). For example:
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
will give you back a string like "iPhone3,1" which has a retina display, or "iPhone 2,1" which hasn't.