cocos2d application compatability with iphone4 and iPad
Dear all, I developed an application on cocos2d, it runs perfectly on simulator (iphone simulator 4) and on iphone 3, but on iphone 4 (device) only part of the application or view appears in the middle of the device all around it is a black area. How can i make my application compatable with iphone 开发者_如何学运维4? and does this make it automatically compatible with iPad or i should make other steps?
Regards
two steps to make an iphone app compatible with iphone4:
each image file should have its high-definition copy, which is twice bigger and suffixed with "-hd", say, add a hello-hd.png (100x100) for hello.png (50x50).
at the beginning, add one code line: [[CCDirector sharedDirector] enableRetinaDisplay:YES];
And it's all done. So far I cannot find a good way for iPad.
I just ported my App to iPad and used this snipped to load the right attributes
NSString* imagePath;
CGPoint imagePos;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// load iPad images and positions
imagePath = @"image-ipad.png";
imagePos = ccp(200,200);
} else {
// load iPhone images and positions
imagePath = @"image.png";
imagePos = ccp(100,100);
}
Than set the path and position variable where you load the image
精彩评论