1

Possible Duplicate:
How to detect iPhone 5 (widescreen devices)?

Does anybody know a better way to detect whether the device is an iPhone 5 than checking the screen height?

[UIScreen mainScreen].bounds.size.height == 568.0;

Thanks in advance.

Community
  • 1
  • 1
mikywan
  • 1,495
  • 1
  • 19
  • 38
  • I think can help you this: [here][1] [1]: http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices/12447113#12447113 – nyanev Nov 02 '12 at 15:17

1 Answers1

7

I use the following macro:

#define IS_IPHONE ( [[[UIDevice currentDevice] model] isEqualToString:@"iPhone"] )
#define IS_HEIGHT_GTE_568 [[UIScreen mainScreen ] bounds].size.height >= 568.0f
#define IS_IPHONE_5 ( IS_IPHONE && IS_HEIGHT_GTE_568 )

And then i can do:

if(IS_IPHONE_5)
{
    NSLog(@"i am an iPhone 5!");
}
else
{
    NSLog(@"This is not an iPhone 5");
}
Frank
  • 16,476
  • 7
  • 38
  • 51