如何以编程方式确定我的应用程序是在iPhone,iPad还是iPhone 4上运行?

问题描述:

我刚刚使用cocos2d完成了我的iPhone游戏。但是在我把它放在AppStore之前,我想让它在iPad(有更大的屏幕)和iPhone 4(有更大的分辨率)上工作。

那么,我该如何确定以编程方式我的应用程序在iPhone,iPad或iPhone 4上运行,以便能够在我的游戏中使用正确的坐标/图像?

I just finish my iPhone game using cocos2d. But before I put it on the AppStore, I'd like to make it work on iPad (which have a bigger screen) and iPhone 4 (which have a bigger resolution).
So, how can I determine programmatically that my app is running on an iPhone, iPad or iPhone 4, to be able to use the correct coordinates / images in my game?

感谢您的帮助!

在iPad和iPhone之间 - 已经 已回答 很多

iPhone和iPhone 4之间 - 报告的尺寸为仍然 320× 480,因此您无需更改任何有关坐标的信息。如果您需要高分辨率UI图像,请为图像创建 @ 2x 备选方案。

Between iPhone and iPhone 4 — The size reported is still 320×480, so you don't need to change anything about the coordinates. Create an @2x alternative for the images if you need a high resolution UI image.