简体   繁体   English

iOS 通用App问题

[英]iOS Universal App question

I have submitted my iPad app to apple and got approved.我已将我的 iPad 应用程序提交给苹果并获得批准。 Now, i want to add iPhone support to the App.现在,我想将 iPhone 支持添加到应用程序。

My question no.1 is:我的问题 1 是:

Q1. Q1。 is it possible to make the app universal at this moment after submission?提交后是否可以在此时使应用程序通用?

If yes, i have question no.2如果是,我有问题 2

Q2. Q2。 my iPhone app is exactly the same as the the iPad but only a few views are in different look due to the customization in screen size.我的 iPhone 应用程序与 iPad 完全相同,但由于屏幕尺寸的自定义,只有少数视图具有不同的外观。 What should I do in XCode to specify which class that iPhone/iPad is using respectively?我应该在 XCode 中做什么来指定 iPhone/iPad 分别使用哪个 class? I can build them smoothly when i separated them into 2 projects.当我将它们分成 2 个项目时,我可以顺利地构建它们。

Thank you.谢谢你。

You can modify the same application and add support of other device.您可以修改相同的应用程序并添加对其他设备的支持。 you need to resubmit application again.您需要重新提交申请。

From with in your code you can detect on which type of device it is executing and based on that you can load appropriate XiB file for each view controller.从您的代码中,您可以检测它在哪种类型的设备上执行,并基于此您可以为每个视图 controller 加载适当的 XiB 文件。

Q1--Yes...you need to upgrade target for iPhone. Q1--是的...您需要升级 iPhone 的目标。 & submit to appStore as universal App.并作为通用应用提交到 appStore。

Q2.You can load Xib to particular device using answer of Question about UIWebview and Universal Application Q2.您可以使用关于 UIWebview 和通用应用的问题的答案将 Xib 加载到特定设备

Yes.It's easy.是的,这很容易。 you have to create Universal app你必须创建通用应用程序

File--->newproject-->Windowsbasedapplication文件--->新项目-->基于Windows的应用程序

and then you select Product type Universal You have a separate view for iphone as well as然后你 select 产品类型Universal你有一个单独的 iphone 视图以及
ipad ipad

You can identify device using this您可以使用此识别设备

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    // iPad stuff
  }
  else {
    // iPhone/iPod stuff
  }

Most of the UI stuff can be redone just with autosizing parameters, but some don't.大多数 UI 内容都可以通过自动调整参数来重做,但有些则不能。

Also for specific classes that do not exist in iPhone/iPod (like UISplitViewController) you can use NSClassFromString , which will return the object class or nil if cannot be loaded.此外,对于 iPhone/iPod 中不存在的特定类(如 UISplitViewController),您可以使用NSClassFromString ,如果无法加载,它将返回 object class 或 nil 。

Q1: Yes, just convert your project to universal and submit it with the same id. Q1:是的,只需将您的项目转换为通用并使用相同的 id 提交即可。

Q2: Fairly easy, conver your project into universal by following the steps here (http://useyourloaf.com/blog/2010/4/7/converting-to-a-universal-app-part-i.html). Q2:相当简单,按照此处的步骤将您的项目转换为通用项目 (http://useyourloaf.com/blog/2010/4/7/converting-to-a-universal-app-part-i.html)。 The basic idea is to extract your business logic from controllers and use different controller for iPhone and iPad.基本思想是从控制器中提取您的业务逻辑,并为 iPhone 和 iPad 使用不同的 controller。 Don't try to implement it with code block like that不要尝试用这样的代码块来实现它

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
     // ipad goes here
}
else
{
     // other
}

note: If you google it, you will find this link, don't use it, it is outdated -- http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html注意:如果你谷歌它,你会发现这个链接,不要使用它,它已经过时了——http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html

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

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