Я хочу представить GameScene
с GameViewController
от моего ViewController
. Я пробовал:Настоящее GameScene от UIViewController
// let GameControllerA2 = GameViewController()
// let transition = CATransition()
// transition.duration = 0.5
// transition.type = kCATransitionPush
// transition.subtype = kCATransitionFromRight
// view.window!.layer.add(transition, forKey: kCATransition)
// self.present(GameControllerA2, animated: true, completion: nil)
if let vc3 = self.storyboard?.instantiateViewController(withIdentifier: "A2ID") as? GameViewControllerA2 {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.window?.rootViewController!.present(vc3, animated: true, completion: nil)
Но это все не работает. Просто, если я просто перетащить [Button] из раскадровки в GameViewController
, это не сбой, но мне это нужно программно. Любые вопросы о моем процессе? Спроси, я отвечу.
Этот код падает. "libC++ abi.dylib: завершение с неперехваченным исключением типа NSException (lldb)" В моем контроллере ViewController я добавил этот код к моей функции. Я не хочу, чтобы в GameScene отображался ViewController, я хочу, чтобы в моем ViewController показывался GameScene. – user6083214