Main.Storyboard 파일에 "MenuVC"라는보기 컨트롤러가 있습니다. 내 GameScene.swift 파일에서이 View Controller를 프로그래밍 방식으로 표시하려고합니다.GameScene.swift에서 컨트롤러보기로 전환
0
A
답변
0
어딘가에 GameScene.swift 파일
: Swift programmatically navigate to another view controller/scene
0
먼저 스토리 보드 뷰 컨트롤러 스토리 보드 ID를 설정 : 여기
//...
let vc = self.storyboard?.instantiateViewController(withIdentifier: "MenuVC") as! MenuVC
self.present(vc, animated: true, completion: nil)
//...
을하지만, 전체 응답이다.
그리고
let menuVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MenuVC" as! MenuVC
그리고 당신은 탐색 컨트롤러
self.navigationController?.pushViewController(menuVC, animated: true)
를 사용하고 또는 당신이 그것을 제공 할 수 있습니다.
self.present(menuVC, animated: true, completion: nil)