2016-12-26 144 views
0

我曾經在那裏時,我的用戶收到一個推送通知設計設置被提出,他們會點擊它,我會發現,正在呈現的最後導航控制器和推一些內容。GET導航控制器的標籤欄控制器

我最近把我的導航控制器的標籤欄裏面,不知道如何找到標籤欄裏面的導航控制器,這樣我可以把它...這是我過的。 。

if var window = UIApplication.shared.keyWindow?.rootViewController { 

     while window.presentedViewController != nil { 
      if let current = window.presentedViewController as? UINavigationController{ 
        window = current 
        } 
      } 
    } 

if let window = window as? UINavigationController { 
     window.pushViewController(vc, animated: true) 
    } 

我如何得到這個,如果現在我的窗前,最終成爲一個標籤欄控制器,而不是上次的導航控制器被呈現爲前工作?

感謝

回答

0

明白了.....

if let tabBar = UIApplication.shared.keyWindow?.rootViewController as? UITabBarController, var window = tabBar.selectedViewController as? UINavigationController { 

     while window.presentedViewController != nil { 
      if let current = window.presentedViewController as? UINavigationController{ 
        window = current 
        } 
      } 
    } 

     window.pushViewController(vc, animated: true) 

作品就像之前...感謝

相關問題