iOS GameOver screen does not appear

80 views Asked by At

We have an error with our iOS game. The gameover screen (containing the score) doesn't come up after losing the game, as it just hangs up. Can anyone suggest what could be the problem and how can we fix this?

We are currently testing and we are not sure if this is the case because of the code or the test settings? But so far the Xcode doesn't show any errors.

Thanks for your help.

1

There are 1 answers

0
Developer On

Open a view from a normal class:

UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:storyBoardName bundle:nil];
UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:StoryboardID];
[self presentViewController:viewController animated:NO completion:nil];

Edit these strings to:
storyBoardName = The name of your storyboard.
storyBoardID = The StoryBoardID of your ViewController.

Open a view from the AppDelegate

UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:storyBoardName bundle:nil];
UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:storyBoardID];
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];

Edit these strings to:
storyBoardName = The name of your storyboard.
storyBoardID = The StoryBoardID of your ViewController.

Other information

How to get the storyBoardName?
If your StoryBoard is called Main.storyboard Main is the title.
If your StoryBoard is called MyName.storyboard MyName is the title

How to set a StoryBoardID?
Select your ViewController. Your View must now be highlighted blue. Go to the identity inspector and under identity you'll find StoryBoardID. Set it to whatever you like.


If it still doesn't work when you use this code you have put in the wrong variables, or there's an unknown error.