在 UISplitViewController 和其他视图控制器之间切换的最佳方式? [英] Best way to switch between UISplitViewController and other view controllers?

查看:28
本文介绍了在 UISplitViewController 和其他视图控制器之间切换的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写 iPad 应用程序.应用程序中的一个屏幕非常适合使用 UISplitViewController.然而,应用程序的顶层是一个主菜单,我不想使用 UISplitViewController.这带来了一个问题,因为 Apple 声明:

I'm authoring an iPad app. One of the screens in the app is perfectly suited to using a UISplitViewController. However, the top level of the app is a main menu, which I don't want to use a UISplitViewController for. This presents a problem, because Apple state that:

  1. UISplitViewController 应该是应用程序中的顶层视图控制器,即它的视图应该作为UIWindow

  1. UISplitViewController should be the top level view controller in the app, i.e. its view should be added as the subview of UIWindow

如果使用,UISplitViewController 应该在应用程序的整个生命周期都存在——即不要从 UIWindow 移除它的视图并放置另一个视图,反之亦然

if used, UISplitViewController should be there for the lifetime of the app -- i.e. don't remove its view from UIWindow and put another in place, or vice versa

经过阅读和试验后,它似乎是满足 Apple 要求的唯一可行选择,而我们自己的要求是使用模态对话框.所以我们的应用程序在根级别有一个 UISplitViewController(即它的视图添加为 UIWindow 的子视图),为了显示我们的主菜单,我们将它作为全屏模式对话框推送到 UISplitViewController 上.然后通过关闭主菜单视图控制器模式对话框,我们实际上可以显示我们的拆分视图.

Having read around and experimented, it seems to only viable option to satisfy Apple's requirements and our own is to use modal dialogs. So our app has a UISplitViewController at the root level (i.e. its view added as the subview of UIWindow), and to show our main menu, we push it as a full-screen modal dialog onto the UISplitViewController. Then by dismissing the main menu view controller modal dialog, we can actually show our split view.

这个策略似乎很有效.但它引出了问题:

This strategy seems to work fine. But it begs the questions:

1) 有没有更好的结构化方法,没有模态,也满足所有提到的要求?通过作为模态对话框推送来显示主 UI 似乎有点奇怪.(模态应该用于专注的用户任务.)

1) Is there any better way of structuring this, without modals, that also meets all the requirements mentioned? It seems a bit odd having the main UI appear by virtue of being pushed as a modal dialog. (Modals are supposed to be for focused user tasks.)

2) 我是否会因为我的方法而面临被应用商店拒绝的风险?根据 Apple 的人机界面指南,这种模态策略可能是滥用"模态对话框.但他们又给了我什么选择呢?无论如何,他们会知道我在做这件事吗?

2) Am I at risk of app store rejection because of my approach? This modal strategy is probably 'misusing' modal dialogs, as per Apple's human interface guidelines. But what other choice have they given me? Would they know that I'm doing this, anyway?

推荐答案

Touche!遇到了同样的问题并使用模态以同样的方式解决了它.在我的情况下,它是一个登录视图,然后主菜单也显示在 splitview 之前.我用了和你想的一样的策略.我(以及与我交谈过的其他几个知识渊博的 iOS 人员)找不到更好的出路.对我来说很好用.无论如何,用户永远不会注意到模态.如此呈现它们.是的,我也可以告诉你,在 App Store 上有很多应用程序在做同样的事情.:) 另外,如果你在某个时候找到更好的方法,请告诉我 :)

Touche! Ran in to the same issue and solved it the same way using modals. In my case it was a login view and then the main menu as well to be shown before the splitview. I used the same strategy as thought out by you. I (as well as several other knowledgeable iOS folks I spoke to) could not find a better way out. Works fine for me. User never notices the modal anyway. Present them so. And yes I can also tell you that there are quite a few apps doing the same under the hood tricks on the App store. :) On another note, do let me know if you figure a better way out somehow someway sometime :)

这篇关于在 UISplitViewController 和其他视图控制器之间切换的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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