从UIViewController呈现GameScene

时间:2016-11-07 15:53:25

标签: ios swift3 viewcontroller sknode

我想在GameScene GameViewController中提出ViewController // 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) 。我试过了:

GameViewController

Code Photo

但这一切都不起作用。就好像我只是将[Button]从Storyboard拖到pipeline = Pipeline(stages=[topic_vectorizer_A, cat_vectorizer_A, topic_vectorizer_B, cat_vectorizer_B, fil_top_a_vect, fil_top_b_vect, fil_cat_a_vect, fil_cat_b_vect, fil_ent_a_vect, fil_ent_b_vect, assembler]) # Note that all the operations in the pipeline are transforms only. model = pipeline.fit(cleaned) # wait 12 hours vectorized_df = model.transform(cleaned) # wait another XX hours # save to parquet. 它没有崩溃,但我需要以编程方式进行。 有关我的流程的任何问题?问,我会回复。

2 个答案:

答案 0 :(得分:0)

首先,您需要将故事板标识符分配给要在当前控制器上显示的视图控制器。您可以在身份检查器部分的故事板中执行此操作

让该标识符为" StoryboardIdentifierForNewClass"并且类名是NewClassViewController。然后,

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("StoryboardIdentifierForNewClass") as! NewClassViewController
self.presentViewController(vc, animated: true, completion: nil)

答案 1 :(得分:0)

这个想法非常简单。

首先,您需要向视图控制器添加SKView

接下来,您将创建一个GameScene对象,并将其添加到SKView

view.presentScene(scene)

就是这样。现在你在ViewController中有你的GameScene。