Where should I present Modal View Controller?

淺唱寂寞╮ 提交于 2019-12-13 07:25:51

问题


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.

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.

So how should I deal with this?


回答1:


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.



来源:https://stackoverflow.com/questions/10537881/where-should-i-present-modal-view-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!