2016-11-11 5 views
0

リモート通知を処理しようとしています。 AppDelegateで私didReceive方法で は、私は、ビューを開くしようとしている:上部ナビゲーションバーが無効です

var storyboard = UIStoryboard(name: "Main", bundle: nil) 
     var destinationController = storyboard.instantiateViewController(withIdentifier: "InfoTraficViewController") as? InfoTraficViewController 
     destinationController?.infoTraficId = trafficInfoId 
     window?.rootViewController?.present(destinationController!, animated: true, completion: nil) 

これは働いているが、トップナビゲーションバーは表示されません。だから、ユーザーは前に行くことはできません。

どうすればよいですか?私が試した:

self.navigationController?.setNavigationBarHidden(false, animated: animated) 

しかし、それは働いていない

EDIT:それはで働いて

:Rajatに

var storyboard = UIStoryboard(name: "Main", bundle: nil) 
    var destinationController = storyboard.instantiateViewController(withIdentifier: "InfoTraficViewController") as? InfoTraficViewController 
    destinationController?.infoTraficId = trafficInfoId 

    var customUiNavController = storyboard.instantiateViewController(withIdentifier: "CustomUINavigationController") as? CustomUINavigationController 
    customUiNavController?.pushViewController(destinationController!, animated: true) 

    window?.rootViewController = customUiNavController 

おかげ

+0

'windows's rootViewControllerは' navController'にする必要がありますか? – aircraft

答えて

1

変更をこの

問題があるように、この

self.navigationController?.pushViewController(destinationController, animated: true) 

と210は

、あなたのUIViewControllerrootViewControllerwindowの上で提示されているので、このViewControllerはあなたUINavigationControllerの上にあります。

+0

は、動作していないappdelegate – Xero

+0

にself.navigationControllerを使用し、UINavigationControllerのオブジェクトに割り当てることができません、何も表示されていません – Xero

+0

押されていない?.rootViewController?.navigationController?.pushViewControllerウィンドウでAppDelegate – Rajat

関連する問題