gpt4 book ai didi

ios - 在应用程序委托(delegate)中制作窗口 Root View Controller 时收到警告 "Presenting view controllers on detached view controllers is discouraged"?

转载 作者:行者123 更新时间:2023-11-28 10:11:46 25 4
gpt4 key购买 nike

这是代码

let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyBoard.instantiateViewController(withIdentifier: "homeTBC") as! UITabBarController
self.window?.rootViewController = vc
self.window?.makeKeyAndVisible()

还想不出来。

最佳答案

我已经在我的应用程序中为应用程序委托(delegate)中的 Root View Controller 尝试了这段代码,工作完美:

因为我认为您正在呈现的 View Controller 或呈现的导航 Controller 中使用此代码:请发送场景(屏幕截图)确切说明您在做什么?

    var window: UIWindow?
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyBoard.instantiateViewController(withIdentifier: "TabbarVC") as! TabbarVC
self.window?.rootViewController = vc

关于ios - 在应用程序委托(delegate)中制作窗口 Root View Controller 时收到警告 "Presenting view controllers on detached view controllers is discouraged"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47090155/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com