<i id='otD64'><tr id='otD64'><dt id='otD64'><q id='otD64'><span id='otD64'><b id='otD64'><form id='otD64'><ins id='otD64'></ins><ul id='otD64'></ul><sub id='otD64'></sub></form><legend id='otD64'></legend><bdo id='otD64'><pre id='otD64'><center id='otD64'></center></pre></bdo></b><th id='otD64'></th></span></q></dt></tr></i><div id='otD64'><tfoot id='otD64'></tfoot><dl id='otD64'><fieldset id='otD64'></fieldset></dl></div>

    <small id='otD64'></small><noframes id='otD64'>

    <legend id='otD64'><style id='otD64'><dir id='otD64'><q id='otD64'></q></dir></style></legend>
  1. <tfoot id='otD64'></tfoot>
      <bdo id='otD64'></bdo><ul id='otD64'></ul>

      创建 iOS 通用应用程序,如何检测所有 5 种分辨率?

      Creating iOS Universal App, How To Detect All 5 Resolutions?(创建 iOS 通用应用程序,如何检测所有 5 种分辨率?)

      1. <tfoot id='uYPst'></tfoot>
        <i id='uYPst'><tr id='uYPst'><dt id='uYPst'><q id='uYPst'><span id='uYPst'><b id='uYPst'><form id='uYPst'><ins id='uYPst'></ins><ul id='uYPst'></ul><sub id='uYPst'></sub></form><legend id='uYPst'></legend><bdo id='uYPst'><pre id='uYPst'><center id='uYPst'></center></pre></bdo></b><th id='uYPst'></th></span></q></dt></tr></i><div id='uYPst'><tfoot id='uYPst'></tfoot><dl id='uYPst'><fieldset id='uYPst'></fieldset></dl></div>

        • <bdo id='uYPst'></bdo><ul id='uYPst'></ul>

          <small id='uYPst'></small><noframes id='uYPst'>

                <legend id='uYPst'><style id='uYPst'><dir id='uYPst'><q id='uYPst'></q></dir></style></legend>
                  <tbody id='uYPst'></tbody>
              • 本文介绍了创建 iOS 通用应用程序,如何检测所有 5 种分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                标题很好地说明了这一点.我正在创建一个 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 种分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                Resume game cocos2d(恢复游戏 cocos2d)
                Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)
                <legend id='yjV3E'><style id='yjV3E'><dir id='yjV3E'><q id='yjV3E'></q></dir></style></legend>

                    • <bdo id='yjV3E'></bdo><ul id='yjV3E'></ul>
                    • <small id='yjV3E'></small><noframes id='yjV3E'>

                      <tfoot id='yjV3E'></tfoot>

                    • <i id='yjV3E'><tr id='yjV3E'><dt id='yjV3E'><q id='yjV3E'><span id='yjV3E'><b id='yjV3E'><form id='yjV3E'><ins id='yjV3E'></ins><ul id='yjV3E'></ul><sub id='yjV3E'></sub></form><legend id='yjV3E'></legend><bdo id='yjV3E'><pre id='yjV3E'><center id='yjV3E'></center></pre></bdo></b><th id='yjV3E'></th></span></q></dt></tr></i><div id='yjV3E'><tfoot id='yjV3E'></tfoot><dl id='yjV3E'><fieldset id='yjV3E'></fieldset></dl></div>

                        <tbody id='yjV3E'></tbody>