<bdo id='EzS7I'></bdo><ul id='EzS7I'></ul>

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

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

      1. <legend id='EzS7I'><style id='EzS7I'><dir id='EzS7I'><q id='EzS7I'></q></dir></style></legend>

        如何使 iphone 和 iphone4-retina 兼容的应用程序(在 cocos2d 中完成)轻松适应 ipad?

        How to make an iphone and iphone4-retina compatible app (done in cocos2d) easily adapted to ipad?(如何使 iphone 和 iphone4-retina 兼容的应用程序(在 cocos2d 中完成)轻松适应 ipad?)
          <tbody id='rBMKF'></tbody>
      2. <i id='rBMKF'><tr id='rBMKF'><dt id='rBMKF'><q id='rBMKF'><span id='rBMKF'><b id='rBMKF'><form id='rBMKF'><ins id='rBMKF'></ins><ul id='rBMKF'></ul><sub id='rBMKF'></sub></form><legend id='rBMKF'></legend><bdo id='rBMKF'><pre id='rBMKF'><center id='rBMKF'></center></pre></bdo></b><th id='rBMKF'></th></span></q></dt></tr></i><div id='rBMKF'><tfoot id='rBMKF'></tfoot><dl id='rBMKF'><fieldset id='rBMKF'></fieldset></dl></div>

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

        <tfoot id='rBMKF'></tfoot>

          • <legend id='rBMKF'><style id='rBMKF'><dir id='rBMKF'><q id='rBMKF'></q></dir></style></legend>

                <bdo id='rBMKF'></bdo><ul id='rBMKF'></ul>
                  本文介绍了如何使 iphone 和 iphone4-retina 兼容的应用程序(在 cocos2d 中完成)轻松适应 ipad?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的问题很简单:1.我做了一个iphone应用,全部在cocos2d中完成.2.我把它适配到了iphone4-retina,所有PNG文件都有自己的-hd副本.

                  My question is simple: 1. I made an iphone app all done in cocos2d. 2. I adapted it to iphone4-retina, with all PNG files have their -hd copy.

                  在 iPhone 中运行,应用正确显示 (320x480).在 iPhone4-retina 中运行,应用也正确显示(640x960).

                  Run in iPhone, the app displayed correctly (320x480). Run in iPhone4-retina, the app also displayed correctly (640x960).

                  但在 iPad 上运行,如果应用程序设置为仅 iPhone,它可以正常运行,但只能以 iPhone 分辨率 (320x480) 运行.如果应用设置为 iPhone/iPad,当然会显示错误.

                  But run in iPad, if the app is set to iPhone only, it run correctly, but only as iPhone resolution (320x480). If the app is set to iPhone/iPad, of cause it will display wrong.

                  我确信应该有一个选项可以强制兼容视网膜的 iPhone 应用程序也作为视网膜在 iPad 上运行(苹果人不会傻到错过它),但我就是找不到.

                  I'm sure there should be an option that force a retina-compitable iPhone app also run as retina on iPad (apple guys cannot be silly enough to miss it), but I just couldn't find it.

                  选项在哪里?或者,cocos2d 是否有一个同样简单的开关来完成这项工作?我不需要诸如使用相对坐标或任何需要修改超过 20 行代码的建议.

                  Where's the option? Or, is there an alternative that cocos2d has a same-easy switch to do the job? I do not need suggestions such as using relative coordinates or anything requires modifications more than twenty code-lines.

                  推荐答案

                  据我所知,iPhone 应用程序并没有自动适配 iPad.您仍然应该能够为 iPhone 和 iPad 创建一个通用应用程序,然后根据您是在一台设备上运行还是在另一台设备上运行来重新创建您的 UI.

                  As far as I know, there is no automatic adaptation of an iPhone app to iPad. You still should be able to create a universal app for both iPhone and iPad and then re-create your UI based on whether you are running on one device or the other.

                  具体来说,您可以:

                  1. 为通用应用程序(armv6 和 armv7,针对 iPad 和 iPhone)创建一个 XCode 项目,并在其中导入您现有的项目(源、资源、设置).

                  1. Create an XCode project for a universal app (armv6 and armv7, targeting iPad and iPhone) and import there your existing project (source, resources, settings).

                  1b.(您可以修改现有项目,但要正确执行此操作可能会比较棘手.)

                  1b. (you could modify your existing project, but this could be trickier to do correctly.)

                  除了 iPhone 的图标和默认图片外,还可以按照 iPad 指南添加图标和默认图片;

                  add icons and default images as per iPad guidelines in addition to those you have for iPhone;

                  至于其余部分,您可以采用与 此处突出显示的方法类似的方法 对于 Xib:

                  As to the rest, you could follow a similar approach to the one highlighted here for Xibs:

                  1. iPad 测试:

                  1. test for iPad:

                  +(布尔)isIpad{return ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);}

                  +(Bool)isIpad{ return ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad); }

                  在加载前翻译图片名称:

                  translate image name before loading:

                  +(NSString*)properImageFileName:(NSString*)imageName {if ([xxxx isIpad]) {return [NSString stringWithFormat:@"ipad_%@", imageName];} 别的 {返回图像名称;}}

                  +(NSString*)properImageFileName:(NSString*)imageName { if ([xxxx isIpad]) { return [NSString stringWithFormat:@"ipad_%@", imageName]; } else { return imageName; } }

                  因此,如果您使用的是 iPhone,图像名称不会更改,并且将遵循 iPhone 的视网膜显示约定;如果您在 iPad 上,您可以随时更改名称并使用正确的图像.(当然,您可以使用您喜欢的约定来识别 iPad 图像).

                  Thus, if you are on iPhone, image names are not changed and will follow the iPhone convention for retina display; if you are on iPad, you change the name on the fly and use the right image. (of course, you can use the convention you prefer to identify iPad images).

                  这应该让它变得非常简单,但请记住,在您的通用应用中包含所有图像会造成尺寸损失.

                  This should make it pretty trivial, but keep in mind the size toll that having all the images in your universal app tolls.

                  这篇关于如何使 iphone 和 iphone4-retina 兼容的应用程序(在 cocos2d 中完成)轻松适应 ipad?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(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 场景重启?)
                  [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)
                1. <tfoot id='Caa3L'></tfoot>

                    <tbody id='Caa3L'></tbody>

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

                        <legend id='Caa3L'><style id='Caa3L'><dir id='Caa3L'><q id='Caa3L'></q></dir></style></legend>

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

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