我应该在哪里展示Modal View Controller? [英] Where should I present Modal View Controller?

查看:110
本文介绍了我应该在哪里展示Modal View Controller?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有UITabBarController的应用程序.我跟踪用户在哪个选项卡上并进行存储,以使他们在重新打开应用程序时位于关闭时的选项卡上.因此,在应用启动时没有默认选项卡.

I have an application with a UITabBarController at its top level. I track which tab a user is on and store it so that when they reopen the application they are on the tab they were on when it was closed. So there is no default tab when the app starts up.

我有一个模态屏幕,每次启动应用程序时都会首先显示.不管保存哪个标签,都始终向用户显示此视图.

I have a modal screen that shows first every time the app starts. It doesn't matter which tab was saved, the user is always presented with this view.

该模态视图应从何处呈现?合理的做法是让UITabBarController呈现它,因为它是rootViewController,但是Apple不鼓励使用UITabBarController的子类.另一种方法是将UIViewController作为可以处理演示文稿的rootViewController,但是Apple坚持认为UITabBarController应该是rootViewController.

Where should this modal view be presented from? The logical thing would be to have the UITabBarController present it as it is the rootViewController, but Apple discourages subclassing UITabBarController. Another approach would be to have a UIViewController as the rootViewController that would handle the presentation, but Apple insist that UITabBarController should be the rootViewController.

那我应该如何处理呢?

推荐答案

如果您从基于窗口的应用程序开始,首先将 viewController 设置为 rootViewController ,然后,完成此 viewController 后,将 tabBarController 设置为 rootViewController ,我认为您没有问题.

If you start with a window-based application  and first set your viewController as rootViewController and then, after you're done with this viewController, set the tabBarController as rootViewController, i think you don't have problems.

这篇关于我应该在哪里展示Modal View Controller?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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