Project Code for Universal App Creation

Step 1

In your Target Info set the Targeted Device Family to “iPhone/iPad”

Step 2

In your appDelegate.m put this bit of code


- (BOOL) isIpad {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return YES;

} else {
return NO;
}
#else
return NO;
#endif
}

To reference it in your other classes do this

in class.h


@interface YourLayerClass : CCLayer {

YourAppDelegate *theDelegate;
Boolean *isIpad;
}

in class.m in your init method


-(id) init
{
if( (self=[super init] )) {

//DEFINE iPad or iPhone
theDelegate = (YourAppDelegate*)[[UIApplication sharedApplication] delegate];
isIpad = [theDelegate isIpad];

}
}

And you can use it in your class thusly


if(isIpad == NO){
bg = [CCSprite spriteWithFile:@"xx_iphone.png"];
}else {
bg = [CCSprite spriteWithFile:@"xx_ipad.png"];
}