如何使用推送通知从AppDelegate打开特定的uitabbarcontroller?

时间:2016-12-26 00:13:53

标签: swift xcode swift3 xcode8 appdelegate

我在我的应用上使用推送通知。因此,当我收到通知并触摸它时,我想转到另一个UITabbarcontroller,但当我这样做时,该应用仅显示UINavigationbar而不显示UITabbarcontroller。这是一个截图 - >

enter image description here

这是我的代码。

         let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "RequestDriverViewController") as! RequestDriverViewController

         let nc = UINavigationController(rootViewController: vc)

         self.window = UIWindow(frame: UIScreen.main.bounds)
         self.window?.rootViewController = nc
         self.window?.makeKeyAndVisible()

1 个答案:

答案 0 :(得分:-1)

我能够解决它:

let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "TabBarIdentifier") as! UITabBarController

        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window?.rootViewController = vc
        self.window?.makeKeyAndVisible()