顶部导航栏已停用

时间:2016-11-11 15:48:02

标签: ios swift apple-push-notifications

我正在尝试处理远程通知。 在我在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)

但它不起作用

编辑:

它正在使用:

 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

感谢Rajat

1 个答案:

答案 0 :(得分:1)

更改此

window?.rootViewController?.present(destinationController!, animated: true, completion: nil)

用这个

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

问题是,您在UIViewController rootViewController上展示了window,因此ViewController位于UINavigationController之上。< / p>