【问题标题】:Modal view doesn't cover whole screen模态视图不覆盖整个屏幕
【发布时间】:2018-03-30 19:57:47
【问题描述】:

我有一个应用程序,每次打开该应用程序时都需要显示一个 PIN 码屏幕。我成功显示了模态视图,但它没有覆盖顶部的导航栏,也没有覆盖底部的标签栏。我相信这是因为我如何呈现它,但我没有看到改变它的方法。

这就是我展示控制器的方式

let newVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LoginView")
let view = window?.rootViewController as! UITabBarController
view.selectedViewController?.show(newVC, sender: nil)

这是让您了解应用程序的故事板。

【问题讨论】:

    标签: ios swift uinavigationcontroller uitabbarcontroller modalviewcontroller


    【解决方案1】:

    问题是你使用了UIViewController's api,show。在这种情况下,该函数被UINavigationController 覆盖,push 将用于呈现视图控制器。如果您的计划是模态显示视图控制器,请使用present

    selectedViewController?.present(newVC, animated: true, completion: nil)
    

    【讨论】:

    • 谢谢,我已经两年没有更新我们的应用程序了,所以我必须跟上自重建应用程序以来的所有更改。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-20
    • 1970-01-01
    • 2013-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-20
    相关资源
    最近更新 更多