2017-09-29 12 views
1

我收到Push Notifications当我点击通知我想要去一个特定的ViewController打开时点击我点击SlideMenu didSelectRow。我尝试了很多SO链接,但下面的代码我能够去特定的ViewController但问题是tabBar它没有显示。标签栏不显示推送通知点击并转到Swift 3.0中的特定ViewController?

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) { 

     let mainstoryboard = UIStoryboard(name: "Main", bundle: nil) 
    let ringingVC = mainstoryboard.instantiateViewController(withIdentifier: "RaffleResultViewController") as? RaffleResultViewController 

    window?.rootViewController = ringingVC 
} 
+0

为什么要补充RaffleResultViewController的窗口,而是定位到RaffleResultViewController使用导航控制器? –

+0

@ h.kishan你可以告诉我如何 – anuj

+0

@ h.kishan RaffleResultViewController是我想浏览的视图控制器,当我点击推送通知和Tabor也出现 – anuj

回答

0
let mainstoryboard = UIStoryboard(name: "Main", bundle: nil) 
let ringingVC = mainstoryboard.instantiateViewController(withIdentifier: "RaffleResultViewController") as? RaffleResultViewController 

let selectedVC = window.rootViewController 

if let nav = selectedVC as? UINavigationController{ 
    nav.pushViewController(ringingVC, animated: true) 
}else{ 
    selectedVC.present(ringingVC, animated: true, completion: nil) 
} 

//使用这个

+0

检查你的答案 – anuj

+0

它不是打开该特定的视图控制器它仍然在与标签栏@ h.kishan自动登录后打开的页面上 – anuj