UISplitViewController - 推送模态视图

发布于 2024-09-09 08:05:39 字数 198 浏览 12 评论 0原文

使用 UISplitViewController 时推送模态视图的最佳实践是什么?您会从 RootViewController、DetailViewController 还是直接从应用程序委托推送?

理想情况下,我想要实现的功能是在基于某些条件加载 UISplitViewController 后立即显示模式视图控制器。

预先感谢您对此事的任何指示。

What is considered the best practise when pushing a modal view when using a UISplitViewController? Would you push from the RootViewController, the DetailViewController or directly from the Application Delegate?

Ideally the functionality I am trying to achieve is to have the modal view controller displayed as soon as the UISplitViewController is loaded based on certain conditions.

Thanks in advance for any pointers on this matter.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷月断魂刀 2024-09-16 08:05:39

我试图做完全相同的事情,并且我得出了以下答案:从应用程序委托中执行此操作更简单。

在纵向模式下,RootViewController 是以一种奇怪的方式(弹出窗口)创建的,因此它不实用,应用程序委托确保您的视图在所有情况下都能正确显示。我不记得在 DetailViewController 中执行此操作有什么问题。

编辑: application:didFinishLaunchingWithOptions: 中的实际实现是这样的:[splitViewControllerpresentModalViewController: modalViewControlleranimated: NO];。希望这有帮助!

I was trying to do the exact same thing, and I've come up with the following answer: it's simpler to do it from the App Delegate.

In Portrait mode, the RootViewController is created in a strange way (popover) so it's not practical, the Application Delegate ensures your view will show properly in all cases. I can't remember what was the issue with doing it in the DetailViewController though.

EDIT: the actual implementation in application:didFinishLaunchingWithOptions: is something like that: [splitViewController presentModalViewController: modalViewController animated: NO];. Hope this helps!

平定天下 2024-09-16 08:05:39

我实际上遇到了同样的问题并发表了这篇文章:

presentModalViewController 将新视图滑动得太远并超出屏幕顶部

基本上,当您从详细视图调用模态视图时,程序会因许多问题而爆炸在模态视图上旋转。

-=-=-=-=-=-

最重要的是,始终从根视图控制器调用模态视图。

I actually ran across the same issue and made this post:

presentModalViewController slides a new view too far up and goes above the top of the screen

Basically, when you call a modal view from the detail view, the program explodes with problems with many to do with rotating while on the modal view.

-=-=-=-=-=-

Bottom line, always call a modal view from the root view controller.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文