0

My final goal is to start on a UIView, go to a SKScene, then back to a UIView. Because this seems to be very difficult my next idea is to leave the UIView active behind the SKScene then change the .hidden value of the SKScene to go from one to the other. Is this possible?

Thanks in advance for your assistance!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Lucas Bullen
  • 211
  • 5
  • 14
  • 1
    possible yes but why not do it right the first time? It's not at all difficult once you know how. Your original question is what you need to do (http://stackoverflow.com/questions/21208579/go-from-skview-back-to-uiview), and the way to do it is with storyboard segues. If you need more info on how to work with storyboards: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/UsingViewControllersinYourApplication/UsingViewControllersinYourApplication.html – CodeSmile Jan 18 '14 at 21:31

2 Answers2

0

you can always present another UIView on top of the SKiew however the scene will keep getting events.

[self.view addSubview:[[UIView alloc]initWithFrame:self.view.bounds]]

or you can present a full view controller on top. the key here is setting the modalPresentationStyle to UIModalPresentationCurrentContext and this will keep the current ViewControler and the Scene running in the background.

UIViewController *uivc = [[UIViewController alloc] init];
[uivc.view setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:0.5]];
self.scene.view.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.scene.view.window.rootViewController presentViewController:uivc animated:YES completion:nil];

(setting the background color is just for you to see the view)

J. V.
  • 366
  • 3
  • 9
-1

One option that worked for me was to put my UIView inside a UINavigationController as the root view. Then I pushed the SKView on to that. When I was done I popped back to the rootView of the nav controller.

Admittedly that may not work for all cases depending on your needs, but perhaps it will work for you.

Mark Reid
  • 2,611
  • 3
  • 23
  • 45