如何将 xcode 4.1 iPhone 应用程序转换为 ipad 应用程序
- 我最近在 Xcode 版本 4.1 中的 iPhone 上开发了一个大项目。
现在我需要将此应用程序转换为适用于 iPad。
我已经验证了很多链接,但所有链接都与 Xcode 3 及其扩展有关。
- 如何升级,如何调整视图大小等 请帮我。提前致谢
- I was recently developed a big project on iPhone in Xcode version 4.1.
Now i need to convert this app for iPad.
I have verified so many links but all are regardig Xcode 3 ond it's extensions.
- How to upgrade, how to resize the view etc etc
Please help me. Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最好的选择是创建两个新项目,一个适用于 iPhone,另一个适用于通用项目,然后看看其中存在哪些差异,尤其是应用程序代表。
很多事情都不需要,但是应用程序初始化需要一些考虑,并且大多数视图往往会愉快地扩展到 ipad 分辨率,而无需太多或任何额外的工作。
这就是我如何将 iPad 支持添加到我正在编写的一款应用程序中的方法。
Your best bet would be to create two new projects, one for iPhone, and the other universal and see what differences are in place there, especially the app delegates.
Quite a lot of the things won't be needed, however the app initialisation need some consideration, and most views tend to happily scale up to ipad resolutions without much or any additional work.
That was how I added iPad support into one of my apps I was writing anyway.
取决于您的应用程序是如何构建的。如果您在 XCode 中使用 Builder,您只需为应用程序中的每个控制器/视图创建新的 xib,并使用后缀 ~ipad 命名。
因此,如果您有 MyController.xib,您将创建 MyController~ipad.xib,并且您的控制器在 iPad 上运行时将自动从此文件加载。
Depends how your app is build. If you are using Builder in XCode you can simply create new xib for each controller/view you have in app and name it with suffix ~ipad.
So if you for example have MyController.xib you will create MyController~ipad.xib and your controller will be loaded from this file automatically when run on iPad.
将项目首选项更改为通用使您可以在 info.plist 文件(主 Nib 文件基本名称 (iPad))中指定第二个 MainWindow.xib,这是 iPad 界面的起点。此时,在 iPhone 上运行该应用程序将加载您的原始界面,并且在创建相应的空白 MainWindow 文件后,在 iPad 上运行该应用程序将为您提供空白窗口。
编辑:您还需要第二个 AppDelegate 来保存对新窗口的引用。
Changing the project preferences to universal gives you the possibility to specify a second MainWindow.xib in the info.plist file (Main Nib file base name (iPad)) which is the starting point for your iPad Interface. At this point running the app on an iphone would load your original interface and running on an iPad gives you the blank window once you created the corresponding blank MainWindow file.
Edit: You need also a second AppDelegate that holds the reference to your new window.