0

I have an iPhone 5 and an iPhone 4s that I am testing an xcode project on. I deleted my app on the iPhone 5 and re-built it and now it recognizes the iphone 5 as an iphone 4. I have tried both

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
    NSLog(@"screen size is %f", screenSize.height);
    if (screenSize.height > 480.0f) {
        return TRUE;
    } else {
        return FALSE;
    }
}

and

#define IS_WIDESCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define IS_IPHONE ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPhone" ] )
#define IS_IPOD   ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPod touch" ] )
#define IS_IPHONE_5 ( IS_IPHONE && IS_WIDESCREEN )

The problem is that somehow [UIScreen mainScreen]bounds.size.height is recognizing my screen height as 480.00000 not 586. Has anyone encountered this error and how do i fix it?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Josh Wang
  • 315
  • 1
  • 4
  • 10

1 Answers1

2

You must have a Default-568h@2x.png image in your code for it to recognize the proper screen height otherwise it will always be FALSE. I had accidentally deleted this image in between builds so it never tested properly.

Josh Wang
  • 315
  • 1
  • 4
  • 10