顶部导航栏已禁用
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)
问题是,您在 window
的 rootViewController
上展示了您的 UIViewController
,所以这个 ViewController
在您的 UINavigationController
之上.
我正在尝试处理远程通知。 在 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)
问题是,您在 window
的 rootViewController
上展示了您的 UIViewController
,所以这个 ViewController
在您的 UINavigationController
之上.