Thank you for your answer.
When you need to switch to another ViewController (via segue), just delete the SKView from the view hierarchy. This will release your SKScene:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
[self.skView removeFromSuperview];
self.skView = nil;
}
Please note that in this case, every time ViewController is about to appear, you need to manually add SKView to view the hierarchy:
if (!self.skView.window) {
[self.view addSubview:self.skView];
}
I am making a Sprite kit Game, including logo screen, main menu, other menus and 2 play scenes. Should I use storyboard? I did it with the pure code of each scene, but I ran into problems when releasing the scene after the conversion. Will using the storyboard solve these problems?
Thank you for your answer.
I will choose the storyboard.
When When you need to switch to another ViewController (via segue), just delete the SKView from the view hierarchy. This will release your SKScene:
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
[self.skView removeFromSuperview];
self.skView = nil;
}
Please note, In this case, every time ViewController is about to appear, you need to manually add SKView to view the hierarchy:
if (!self.skView.window) {
[self.view addSubview:self.skView];
}