我想从 AppDelegate
转到 UITabBarController
的第一个 View 。
我将 UITabBarController
的 StoryBoardID
指定为“主页”。
我试过下面的代码:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController: UITabBarController = storyboard.instantiateViewControllerWithIdentifier("HomePage") as! UITabBarController
let rootViewController = self.window!.rootViewController as! UINavigationController
rootViewController.pushViewController(viewController, animated: true)
它有效,但我在我不想要的目标 View 上给出了 BackBarButton
。
我现在想继续。
最佳答案
您需要设置您的 viewControllers
而不是 pushViewController
rootViewController.viewControllers = [viewController]
代替
rootViewController.pushViewController(viewController, animated: true)
关于ios - swift 从 Appdelegate 转至 UITabBarController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39159892/