Reputation: 65
Currently I'm defining my app's background image in XCode's Attribute Inspector under Image View.
I'd like to, however, use a different background when an iPhone 5 views the app -- this is for a gaming app so certain screens have tables that I want to make longer. I know this has been written about a lot and some if/then statements are required. My question is: If I've already defined the background image using the Attribute Inspector, is there code to overwrite that which I can add to my .h and .m files?
Here's what I'm thinking: This is the code I'd add to my AppDelegate file:
#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)
This is the code I'd use in my .m file:
if(IS_IPHONE_5) {
} else {
}
So here really is what I'm looking for:
Upvotes: 1
Views: 390
Reputation: 2073
simply take the image you want to display instead of your already existant a "[email protected]" with size 640 x 1136 so xcode will automatically use that image when the device is an iphone 5 anywhere your app calls for the "HomeBG.png" image. Hope that helps!
Upvotes: 1