将iPhone应用程序转换为通用应用程序? [英] Converting an iPhone app to a Universal app?

查看:109
本文介绍了将iPhone应用程序转换为通用应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iPhone应用程序
FirstViewController SecondViewController 各自的观点 FirstView.xib SecondView.xib

I have an iPhone app with FirstViewController and SecondViewController with respective views FirstView.xib and SecondView.xib.

现在我想让这个应用程序适用于iPhone和iPad。对于iPad,我需要合并 Firstview.xib SecondView.xib 进入单个 ThirdView-iPad.xib

Now I want to make this app work with both iPhone and iPad. For iPad I need to merge Firstview.xib and SecondView.xib into a single ThirdView-iPad.xib.

什么是最好的方法?我是否需要为iPad编写另一个ViewController类,或者我可以使用现有的 FirstViewController SecondViewController

What would be the best approach? Do I need to write another ViewController class for iPad or can I use existing FirstViewController and SecondViewController with single xib?

到目前为止,我的研究表明,没有办法将多个ViewControllers与单个xib一起使用。请告诉我最好的方法。

My research so far says that there is no way to use multiple ViewControllers with single xib. Please let me know the best way to do this.

谢谢

推荐答案

除非你是受虐狂,否则你最好只创建一个新的ViewController。以这种方式重用很可能会遇到很多麻烦,如果你需要在ViewControllers中重用逻辑,我会选择聚合或继承。

You would be best of to just create a new ViewController unless you're into masochism. Reusing in that way would most likely be to much trouble, and I'd go with aggregation or inheritance in the case you need to reuse logic in your ViewControllers.

我通常创建一个基本的ViewController,比如 XYZViewController 然后用所有iPhone特价和一个单独的<$ c $创建一个 XYZViewController_iPhone c>适用于iPad的XYZViewController_iPad 。但如果它们完全不同,我会给它们提供唯一的名称和它们自己的NIB以及ViewControllers。

I typically create a base ViewController, say XYZViewController and then create a XYZViewController_iPhone with all iPhone-specials and a separate XYZViewController_iPad for iPads. But if they're totally different I give them unique names and their own NIBs as well as ViewControllers.

这篇关于将iPhone应用程序转换为通用应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆