场景 - 根据 iPad 或 iPhone 使用专用的故事板 [英] Scenes - Use dedicated Storyboards depending iPad or iPhone

查看:53
本文介绍了场景 - 根据 iPad 或 iPhone 使用专用的故事板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple 现在希望我们使用场景"而不是用于显示 iPad 和 iPhone 内容的窗口和屏幕.现在添加了对场景的支持,我似乎失去了使用 Storyboards 定位 iPad 或 iPhone 的能力?

Apple now wants us to use "scenes" rather than windows and screens to display content in for iPad and iPhone. Now having added the support for scenes I seem to have lost the ability to target iPad or iPhone with Storyboards?

我将场景设置在 plist 中,如下所示:

I set my scenes inside plist like this:

这是从一个新项目中复制的,因为 Apple 似乎忘记记录如何向现有应用添加场景.苹果没有充分记录的另一个例子!

This was copied from a new project, as Apple seems to have forgotten to document how to add scenes to an existing app. Another example of Apple not documenting sufficiently!

现在我似乎失去了在 iPhone 和 iPad 上使用不同故事板的能力.

Now I seem to have lost the ability to use different storyboards for iPad from iPhone.

虽然我可以为 iPad 使用与 iPhone 相同的故事板,但我的应用程序在 iPad 的专用界面下看起来更好,因为我使用它提供的额外空间来提供更好的最终用户体验.iPhone 很好,界面最适合小显示器,但在 iPad 上看起来很贫瘠.

Whilst I could use the same storyboard for the iPad that I use with the iPhone my app looks better with the dedicated interface I have for the iPad because I use the extra real estate it offers to give a better end user experience. iPhone is fine, the interface is best suited to a small display but looks barren on an iPad.

帮助!

推荐答案

现在我似乎失去了在 iPhone 和 iPad 上使用不同故事板的能力

Now I seem to have lost the ability to use different storyboards for iPad from iPhone

这很简单(而且,正如你所说,没有记录).您的 Info.plist 中需要两个完全独立的场景清单条目,即 UIApplicationSceneManifestUIApplicationSceneManifest~ipad.它们只是指定了不同的 UISceneStoryboardFile 值,并且您就像场景出现之前一样设置好了.

It's quite simple (and, as you say, not documented). You need two completely separate scene manifest entries in your Info.plist, i.e. UIApplicationSceneManifest and UIApplicationSceneManifest~ipad. They just specify different UISceneStoryboardFile values, and you're all set just as before scenes came along.

这篇关于场景 - 根据 iPad 或 iPhone 使用专用的故事板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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