2017-12-30 58 views
0

캐스팅 할 수 없습니다 값 '은 UINavigationController'은 내가 어떻게 언급 그들이 충돌 유형의 'UINavigationController가'

내가 내 DetailViewController.But의 메소드를 호출 할 (0x37aa0dc8) t 타입의 값과 표시 오류를 캐스팅 할 수 없습니다 해결 할 위

func move() 
{ 
    let VC = storyboard!.instantiateViewController(withIdentifier: "PDF") as! PDFViewController 

    self.navigationController?.pushViewController(VC, animated: true) 
} 

답변

0

보기 컨트롤러를 탐색 컨트롤러에 캐스팅하고 해당 topViewController 속성에 액세스합니다.

let pdfVC = (storyboard!.instantiateViewController(withIdentifier: "PDF") as! UINavigationController).topViewController as! PDFViewController 

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