2016-11-11 2 views
0

원격 알림을 처리하려고합니다.위쪽 탐색 모음이 비활성화되었습니다.

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) 

이 작동하지만, 상단 네비게이션 바는 표시되지 않습니다 : AppDelegate에 내 didReceive 방법에서 , 내가보기를 열 것을 시도하고있다. 따라서 사용자는 이전으로 갈 수 없습니다.

어떻게해야합니까? 나는 시도 :

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 

감사

+0

'windows's rootViewController는'navController' 여야합니다, 그렇습니까? – aircraft

답변

1

변경이

문제이므로이

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

와210

, 당신은 당신의 UIViewControllerrootViewControllerwindow의에 제시되어 있으므로이 ViewControllerUINavigationController의 상단에 있습니다.

+0

AppDelegate – Xero

+0

에서 self.navigationController를 window와 함께 사용할 수 없습니까? .rootViewController? .navigationController? .pushViewController, 아무 것도 전혀 푸시되지 않습니다. – Xero

+0

AppDelegate에서 UINavigationController의 개체를 만들고 UINavigationController의 개체에 할당 한 다음 해당 개체를 appdelegate에 사용하십시오. – Rajat

관련 문제