Question

From prefix.pch I want to return 4 if iPhone is iPhone 4 or lower and 5 if iPhone is iPhone 5 or more...

I know how to know the height

#define iPhoneHeight [[UIScreen mainScreen] bounds].size.height

Based on this, I get height, but I want to return 4 or 5.

Any idea how to get this done?

Was it helpful?

Solution

You can compare height with value in points for 4 inch display like this:

#define iPhone4Or5 [[UIScreen mainScreen] bounds].size.height == 568 ? 5 : 4

OTHER TIPS

Wouldn't this help ?

    #define isIPhone4or5 CGSizeEqualToSize([[UIScreen mainScreen] preferredMode].size,CGSizeMake(640, 1136)) ? 5 : 4
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top