gpt4 book ai didi

ios - 如何过渡到带有导航栏的 View Controller ?

转载 作者:行者123 更新时间:2023-11-29 05:54:30 25 4
gpt4 key购买 nike

我有两个模块需要连接。

  1. 授权模块,由 1 个屏幕组成。没有 Controller 在其上导航,但它不在其堆栈中。
  2. 主要应用程序。第一个屏幕是 Controller 的根导航。

如何在Swift代码中实现授权成功后从授权界面到主应用的转换?

My screen scheme

解决方案:

我在我的案例中使用这个解决方案:

let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "rootVC")
UIApplication.shared.delegate?.window??.rootViewController = vc
view.present(vc, animated: true) {
self.view.dismiss(animated: false, completion: nil)
}

最佳答案

将storyboardId“nav”提供给导航 Controller ,然后将其显示在您的登录 View Controller 上。

if let nav = self.storyboard?.instantiateViewController(withIdentifier: "nav") {
self.present(nav, animated: true, completion: nil)
}

关于ios - 如何过渡到带有导航栏的 View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55294787/

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