问题描述
将 iPad 应用程序转换为 iPhone-通用应用程序.
Convert iPad application to iPhone- Universal app.
我已经有一个 iPad 应用程序,现在我想为那个 iPad 应用程序制作一个通用应用程序.
I already have one iPad application, now I want to make a universal app of that iPad application.
如何转换?是否可以?还是我必须启动一个新应用?
How to convert? Is it possible? Or do I have to start a new app?
推荐答案
在 Interface Builder 中打开您的项目.单击Targets"旁边的显示三角形,然后右键单击目标并选择Upgrade Current Target for iPad...".
Open up your project in Interface Builder. Click on the disclosure triangle next to "Targets", then right-click on the target and choose "Upgrade Current Target for iPad...".
然后阅读 iPad 编程指南,尤其是 开始你的项目.
Then read the iPad Programming Guide, especially the section Starting Your Project.
我现在明白了——从 iPad 到 iPad/iPhone.
I see now -- iPad to iPad/iPhone.
我认为您会执行以下操作:
I think you would do something like the following:
- 为 iPhone 创建一个 .xib主窗口/应用程序委托/等,以对应您现有的 .xibiPad.
- 在您的信息列表中添加一个条目:
NSMainNibFile
,其值为您的新 iPhone xib 的名称 - 转到您的构建设置并设置基础 SDK 到 4.1(或者 4.0,如果你仍然安装旧版 SDK)
- 保持您的 iOS 部署目标如果您只是在 3.2 构建设置担心 iPhone 和 iPod涉及 4.x.
- 设置目标设备系列构建设置为 iPhone/iPad
- 开始重构您的代码以创建两个不同的代码路径,一个一个用于 iPhone,一个用于 iPad,其中合适.
- Create a .xib for the iPhone for the Main Window/App Delegate/etc, to corresspond your existing .xib for iPad.
- Add an entry in your info plist:
NSMainNibFile
, with the value of the name of your new iPhone xib - Go to your build settings and set the Base SDK to 4.1 (or 4.0 if you still have the older SDK installed)
- Keep your iOS Deployment Target build setting at 3.2 if you're only worried about iPhones and iPod Touches with 4.x.
- Set the Targeted Device Family build setting to iPhone/iPad
- Start refactoring your code to create two different code paths, one for iPhone and one for iPad, where appropriate.
这篇关于将 ipad 应用程序转换为 iphone.通用应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!