Search code examples
ipadscreenresolutionretina-display

iPad screen size always 1024x768, even on retina and Air


I want to test my app to make sure the images display properly on a 1536x2048 landscape. I have an NSLog statement output the screen height to verify.

-(id)initWithSize:(CGSize)size {
    if (self = [super initWithSize:size]) {
NSLog(@"height: %f",self.frame.size.height);

However, it always shows that the height is 768, even if I use a physical iPad Air or any of the simulators. As I understand it, the Air and retina devices should show a height of 1536.

Any ideas on what might be causing this?


Solution

  • Uncommenting a line of code in AppDelegate.m as follows, allows you to set surface size 1536x2048; obviously you have to provide a valid "image~ipad-hd.png" file in your resources.

     // // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
            if( ! [director enableRetinaDisplay:YES] ) CCLOG(@"Retina Display Not supported");
    

    The bad new is that in return, you'll get a totally black screen on ipad hires simulators; but I solved! Answers are already in stackoverflow here: Black screen on iPad retina display

    You have to add another line of code like this as user Shamim Hossain's suggestion:

    //  // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
        if( ! [director enableRetinaDisplay:YES] ) CCLOG(@"Retina Display Not supported");
    
        [director setProjection:kCCDirectorProjection2D];