标题很好地说明了这一点.我正在创建一个 iOS 应用程序,并且正在添加艺术资产.我有 iPhone 低分辨率(iPhone 3GS 或更低版本)、iPhone 视网膜(iPhone 4 或更高版本)、iPhone 5、iPad 低分辨率和 iPad 高分辨率的 5 个背景.
Title pretty well says it. I'm creating an iOS app and am at the point of add art assets. I have 5 backgrounds for iPhone low res(iPhone 3GS or lower ), iPhone retina (iPhone 4 or higher), iPhone 5, iPad low res, and iPad high res.
根据设备处理加载哪个背景的最佳方法是什么?
What's the best way to handle which background gets loaded based on the device?
另外,有没有办法测试所有 5 个在模拟器中的样子?当然,现在你只能测试 iPhone 和 iPad.
Also, is there a way to test what all 5 looks like in the simulator? Right now, of course, you can only test iPhone and iPad.
另外,这是一个游戏,如果能有所作为,我正在使用 cocos2d.
Also, this is a game and I'm using cocos2d if that would make a difference.
对于cocos2D-iPhone,默认后缀如下:
For cocos2D-iPhone, the default suffixes are as follows:
wiki 页面的注释:
警告:不建议使用@2x"后缀.Apple 以特殊方式处理这些图像,这可能会导致您的cocos2d 应用程序.
WARNING: It is NOT recommend to use the "@2x" suffix. Apple treats those images in a special way which might cause bugs in your cocos2d application.
Cocos2D 将自动检测您的硬件并加载相应的图像.您可以在 AppDelegate.m 中更改默认后缀.
Cocos2D will automatically detect your hardware and will load the appropriate image. You can change the default suffixes in AppDelegate.m.
AFAIK,iPhone 5 图像没有后缀,因此您可以通过检测设备高度来手动检测和加载自定义精灵:
AFAIK, there is no suffix for iPhone 5 images, so you can manually detect and load your custom sprite by detecting the device height:
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
// code for iPhone 5
} else {
// code for all other iOS devices
}
正如其他人所说,您可以通过模拟器测试所有设备(硬件->设备)
And as the others said, you can test all devices through the simulator (Hardware -> Device)
这篇关于创建 iOS 通用应用程序,如何检测所有 5 种分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!