是否有全球方式将iPhone和iPad应用程序合并到通用应用程序中? [英] Is there a global way to merge an iPhone and an iPad app into a universal app?

查看:113
本文介绍了是否有全球方式将iPhone和iPad应用程序合并到通用应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个iPhone应用程序。然后,我更改了界面,添加了更高分辨率的图像,并制作了iPad版本。在一个完美的世界里,我希望任何购买iPad版本的人都能免费获得iPhone版本(尽管不是相反)。由于Apple似乎没有办法做到这一点(对吗??),我的下一个最喜欢的解决方案是让iPad版本以某种方式包含iPhone版本。

I wrote an iPhone app. Then, I changed the interface a fair bit, added higher res images, and made an iPad version of it. In a perfect world, I would like for anyone who buys the iPad version to get the iPhone version for free (though not conversely). Since Apple doesn't seem to have a way to do that (right??), my next favorite solution is to make the iPad version include the iPhone version somehow.

我知道我可以将iPad版本转换为通用,但由于应用程序的外观如此不同,这似乎是一种真正的痛苦。我有很多视图控制器,它们在两个版本之间几乎完全不同。有些方法是相同的,但只有约30%。有一个简单的解决方案:

I know that I could just convert the iPad version to "universal", but since the face of the app is so different, that seems like a real pain. I have many view controllers and they are almost completely different between the two versions. Some of the methods are the same, but only about 30%. Is there an easy solution along the lines of this:


  • 检查设备是iPhone还是iPad

  • Check if device is iPhone or iPad


  • 如果是iPhone,则使用一组文件

  • If iPhone, then use one group of files

如果是iPad,则使用一组不同的文件

If iPad, then use a different group of files

提前致谢!

推荐答案

尝试在Xcode中创建一个新项目并选择将其作为通用应用程序。在Xcode的默认方式中,iPad和iPhone版本之间存在明显的差异。您可以根据需要使应用程序的两个版本相似或不同。

Try creating a new project in Xcode and choose to make it a universal app. In the default way Xcode lays it out, there is a distinct divide between the iPad and iPhone versions. You can make the two versions of the app as similar or different as you want.

此外,您可以使用<$检查运行时运行的设备。 C $ C> UI_USER_INTERFACE_IDIOM()。目前,这两个值是 UIUserInterfaceIdiomPad UIUserInterfaceIdiomPhone

In addition, you can check which device you are running on at runtime by using UI_USER_INTERFACE_IDIOM(). Currently the two values for this are UIUserInterfaceIdiomPad and UIUserInterfaceIdiomPhone.

这篇关于是否有全球方式将iPhone和iPad应用程序合并到通用应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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