我正在嘗試處理遠程通知。 在我的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
由於拉雅
你的'windows's rootViewController應該是'navController',是嗎? – aircraft