IPad3 High Definition Mesh Network Issue
I am developing an iPad3 (Retina Display) app using Xcode 4.2 [iOS SDK 5.0]. I am using the following piece of code to detect retina display (high resolution).
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
{
NSLog(@"scale = %f",[[UIScreen mainScreen] scale]);
if ([[UIScreen mainScreen] scale] > 1.0) {
NSLog(@"Retina Display iPad3");
}
else
{
NSLog(@"Non Retina Display iPad 1/2");
}
}
When I install the app on iPad3 it shows the output:
scale = 1.00000;
Non Retina Display iPad 1/2.
The above code does not detect Retina display.
I tried all codes related to retina display detection from google, but all codes failed to detect retina display. Is there any method to detect iPad 3 retina display.
Thanks in advance.
In order for your app to support the new iPad retina screen, you need to develop and build against the 5.1 SDK (which I think means you need to use XCode 4.3).
+ (BOOL)isRetina
{
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2.0) {
return YES;
}
return NO;
}
I tested iPad3, this method returns YES
.
Try replacing:
if ([[UIScreen mainScreen] scale] > 1.0) {
by
if ([[UIScreen mainScreen] scale] >= 1.0) {
(I may have missed this point, but if iPad3 has 1.0 scale then "> 1.0" is not correct)