xcode iPhone 应用程序转换为 iPad?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5069674/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iPhone app converting to iPad?
提问by Linuxmint
I want to convert my app to a Universal app. Can anyone recommend some good tutorials for achieving this?
我想将我的应用程序转换为通用应用程序。任何人都可以推荐一些很好的教程来实现这一目标吗?
I need to have each View in Interface Builder as a separate, view for iPhone or iPad.
我需要将 Interface Builder 中的每个视图作为 iPhone 或 iPad 的单独视图。
Thanks in advance!
提前致谢!
回答by hotpaw2
I just did this mostly manually, using approximately the following steps:
我只是主要使用以下步骤手动完成此操作:
Load the app's main window xib in Interface Builder, use the IB menu "Create iPad Version" to convert it to an iPad version, and save it under an appropriate name (a "-iPad.xib" suffix is common.)
在 Interface Builder 中加载应用程序的主窗口 xib,使用 IB 菜单“创建 iPad 版本”将其转换为 iPad 版本,并以适当的名称保存(“-iPad.xib”后缀很常见。)
In Xcode, add this new .xib file to your project and include it in the app's target.
在 Xcode 中,将此新的 .xib 文件添加到您的项目并将其包含在应用程序的目标中。
Modify the app's Info.plist to name this new ipad xib under the "NSMainNibFile~ipad" key.
修改应用程序的 Info.plist 以在“NSMainNibFile~ipad”键下命名这个新的 ipad xib。
Change the Build target setting to say iPhone/iPad as the targeted device.
更改构建目标设置,将 iPhone/iPad 作为目标设备。
Add run-time code checks such as:
添加运行时代码检查,例如:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { ... }
to handle any programmatically created UI or drawing differences, select iPhone versus iPad xibs, etc.
处理任何以编程方式创建的 UI 或绘图差异,选择 iPhone 与 iPad xibs 等。
Add appropriate icon sizes, default images, etc.
添加适当的图标大小、默认图像等。
Redesign your views to optionally display more stuff, autoresize to support more rotations, use popovers, etc.
重新设计您的视图以选择性地显示更多内容、自动调整大小以支持更多旋转、使用弹出框等。