David Muldarov David Muldarov - 10 months ago 59
Objective-C Question

How to Detect IOS 7, 8 and widescreen?

I am developing universal game for all iPhone 4 and higher and for all iPads, I want it work for IOS 7 and 8. I have tried a lot of macros but never they work ether for all devices or IOS 7 and 8.I am a beginner developer and I dont know how to solve this problem. I uploaded images to dropbox and you can get them at this link here https://www.dropbox.com/sh/pnll2e2jvo0uigs/AACOLbzzQqZlJEZZcBx7TMR1a?dl=0

here is the code I am using for my SpriteKit game to add background to the scene:

#import "GameScene.h"
#import <UIKit/UIKit.h>

#define IS_WIDESCREEN (( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) || ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.width - ( double )568 ) < DBL_EPSILON ))

@implementation GameScene

-(id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
background = [SKSpriteNode spriteNodeWithImageNamed:@"Background-568"];
background = [SKSpriteNode spriteNodeWithImageNamed:@"Background"];

background = [SKSpriteNode spriteNodeWithImageNamed:@"Background~iPad"];

background.anchorPoint = CGPointMake(0.5, 1);
background.position = CGPointMake(self.size.width/2, self.size.height);
//background.zPosition = LayerBackground;
[self addChild:background];

return self;


I would much appreciate if you could help me to solve this problem and give me the code in answer you post, like what macros to put and usage of it. also use my code for background and images uploaded to dropbox. Thanks a lot.


For example, I use this code to check for the device's screen:

//Getting iDevice's screen width
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;