问题描述
标题很好地说明了这一点.我正在创建一个 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:
- 非视网膜 iPhone:image.png
- 视网膜 iPhone:image-hd.png
- 非视网膜 iPad:image-ipad.png
- Retina iPad:image-ipadhd.png
- Non-retina iPhone: image.png
- Retina iPhone: image-hd.png
- Non-retina iPad: image-ipad.png
- Retina iPad: image-ipadhd.png
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 种分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)