简体   繁体   English

Xcode-如何制作通用应用

[英]Xcode - How to make a universal app

I have an iPhone app and I want to make it universal, but I don't know how to go about doing this, at least properly anyway. 我有一个iPhone应用程序,我想使其普及,但至少无论如何,我都不知道该怎么做。 Earlier I tried the "upgrade current target to iPad" but it didn't work properly, but luckily I saved a backup from just before trying it. 早些时候,我尝试了“将当前目标升级到iPad”,但是无法正常工作,但是幸运的是,在尝试之前,我保存了备份。

Anyway, can anyone advise me on how to do this? 无论如何,有人可以建议我这样做吗?

Create a new MainWindow_iPad.xib file targeted to iPad. 创建一个针对iPad的新MainWindow_iPad.xib文件。 Open the app's info.plist file. 打开应用程序的info.plist文件。 Add a new key for (something like) Main Nib Name(iPad). 为主要笔尖名称(iPad)添加一个新密钥。 (Don't worry, Xcode will give you autocomplete options) Set it to this new .xib file. (不用担心,Xcode会为您提供自动完成选项)将其设置为这个新的.xib文件。 Now, when the app boots on an iPad, it'll load the new .xib. 现在,当该应用在iPad上启动时,它将加载新的.xib。 You can now write your code as normal. 现在,您可以正常编写代码了。

if ([[UIDevice currentDevice] userInterfaceIdiom]==UIUserInterfaceIdiomPhone) {
} else {
  //...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM