我正在尝试处理远程通知。 在我在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
答案 0 :(得分:1)
更改此
window?.rootViewController?.present(destinationController!, animated: true, completion: nil)
用这个
self.navigationController?.pushViewController(destinationController, animated: true)
问题是,您在UIViewController
rootViewController
上展示了window
,因此ViewController
位于UINavigationController
之上。< / p>