繁体   English   中英

顶部导航栏已禁用

[英]Top navigation bar disabled

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

改变这个

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

有了这个

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

因为问题是,您正在将UIViewController呈现在windowrootViewController上,所以此ViewControllerUINavigationController之上。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM