针对 Xcode 中的 iPad 选项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4765173/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:07:36  来源:igfitidea点击:

Targeted for iPad option in Xcode

iosiphonexcodeipad

提问by Chiron

In Xcode when creating a subclass of UIViewController, an checkbox named "Targeted for iPad" exists among others.
What if I want to create an app that runs on iPhone and iPad (I think it is called universal application)? should I check it?
If I checked it, what is happening under the hood?

在 Xcode 中创建 UIViewController 的子类时,存在一个名为“Targeted for iPad”的复选框。
如果我想创建一个在 iPhone 和 iPad 上运行的应用程序(我认为它被称为通用应用程序)怎么办?我应该检查一下吗?
如果我检查它,引擎盖下发生了什么?

回答by grahamparks

I tried both with and without and diffed the generated files.

我尝试了有和没有并比较生成的文件。

The only difference it makes is whether the pre-built shouldAutorotate:method returns YES to all orientations (normal for iPad apps) or just for portrait (normal for iPhone apps). It also changes the dimensions of the UIView in the generated XIB file (if you tick the option to create one) from iPhone to iPad screen size.

它的唯一区别是预构建的shouldAutorotate:方法是对所有方向(iPad 应用程序正常)还是仅纵向(iPhone 应用程序正常)返回 YES。它还会将生成的 XIB 文件中 UIView 的尺寸(如果您勾选创建一个的选项)从 iPhone 更改为 iPad 屏幕尺寸。

So just choose whichever one sounds like the best starting point for the class you're about to create. Both things are trivial to edit later.

因此,只需选择听起来最适合您将要创建的课程的起点即可。这两件事都是微不足道的,以后再编辑。