Search code examples
iosswiftuiviewskscene

Popup view goes back to initial SKScene instead of current SKScene


I have two SKScenes that are called StartMenu, GameMenu and I have created a popup view (AddSubView) to be added inside GameMenu.

My problem is that whenever I call the function that runs the popupview, it goes back to the initial SKScene - StartMenu instead of the current SKScene GameMenu.

code:

            var v :UIView = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
            v.backgroundColor = UIColor.blueColor()
            self.scene?.view?.addSubview(v)

Solution

  • I have decided to avoid using subViews for SpriteKit as according to Apple, it is best to create Popup menus using SKSpriteNode and SKNodes.