Home > Software design >  cannot interact with viewcontroller after segue
cannot interact with viewcontroller after segue

Time:09-16

I have a rather bizarre problem. I have a game made in sprite kit with 2 view controllers, one for the game, one for the menu. when the game ends, the view controller segues back to the menu and closes the game window, this works fine the first time, but if you then go to play another game, lose and come back, for some reason you cannot interact with the menu view controller in any way. Here is my code, running from the SKScene:

        [self.view.window.contentViewController performSegueWithIdentifier:@"endGame" sender:self];
        [self.view.window performClose:nil]; //close the window

As I said before, it works the first time, but not the second, it displays the menu but you cant interact with it.

CodePudding user response:

So I worked out what the issue is. When you create a new view controller in the storyboard, it also creates a new window controller. I was using 2 window controllers in my app, by removing 1 of these and linking the menu window to the window controller for the game scene it fixed the problem.

  • Related