gpt4 book ai didi

ios - 过渡到新的 View Controller

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

因此在验证用户登录详细信息后调用这段代码:

func completeLogin() {
dispatch_async(dispatch_get_main_queue(), {
let tabBarController = self.storyboard!.instantiateViewControllerWithIdentifier("PostLoginTabBarController") as! UITabBarController
let tableViewController = self.storyboard!.instantiateViewControllerWithIdentifier("InformationTableViewController") as! InformationTableViewController
let tableViewNavController = UINavigationController(rootViewController: tableViewController)
tabBarController.viewControllers?.removeAll()
tabBarController.viewControllers?.append(tableViewNavController)
self.presentViewController(tabBarController, animated: true, completion: nil)
})
}

在我的 Storyboard中:

enter image description here

我有 PostLoginTabBarController 与其他 2 个 ViewControllers 有关系

我的问题是:

有没有比移除 PostLoginTabBarController 拥有的所有 View Controllers,然后在 completeLogin() 中添加新的实例化 Controller 更好的方法> 方法?我这样做的原因是,如果我在 PostLoginTabBarController 出现时切断 PostLoginTabBarController 之间的关系,它会显示黑屏,但如果我不切断关系那么就可以了。

这是我断绝关系的例子:

enter image description here

当我不这样做时:

enter image description here

最佳答案

您是否尝试过使用 setViewControllers(_ viewControllers: [UIViewController]?, animated animated: Bool) 而不是

tabBarController.viewControllers?.removeAll()
tabBarController.viewControllers?.append(tableViewNavController)

关于ios - 过渡到新的 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34103649/

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