我的Main.Storyboard文件中有一个名为“MenuVC”的视图控制器。我想以编程方式从我的GameScene.swift文件中显示这个View Controller。
答案 0 :(得分:0)
GameScene.swift文件中的某个地方:
//...
let vc = self.storyboard?.instantiateViewController(withIdentifier: "MenuVC") as! MenuVC
self.present(vc, animated: true, completion: nil)
//...
但这里是完整的答案:Swift programmatically navigate to another view controller/scene
答案 1 :(得分:0)