Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Knowing device type -- Retina/non-Retina [duplicate]

Possible Duplicate:
Detect Retina Display

How can we know if a device has a retina display or not from objective C code?

like image 576
Abhinav Avatar asked Apr 06 '11 15:04

Abhinav


2 Answers

if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]
    && [[UIScreen mainScreen] scale] >= 2.0) {
    // Retina
} else {
    // Not Retina
}
like image 68
Stanislav Yaglo Avatar answered Nov 15 '22 11:11

Stanislav Yaglo


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.

like image 23
GorillaPatch Avatar answered Nov 15 '22 11:11

GorillaPatch