我们的 iOS 游戏出现错误。游戏结束屏幕(包含分数)在输掉游戏后不会出现,因为它只是挂断了。任何人都可以建议可能是什么问题以及我们如何解决这个问题?
我们目前正在测试,我们不确定是否是因为代码或测试设置的原因?但到目前为止,Xcode 没有显示任何错误。
感谢您的帮助。
最佳答案
从普通类打开 View :
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:storyBoardName bundle:nil];
UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:StoryboardID];
[self presentViewController:viewController animated:NO completion:nil];
将这些字符串编辑为:
storyBoardName = Storyboard的名称。
storyBoardID = 您的 ViewController 的 StoryBoardID。
从 AppDelegate 打开一个 View
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];
将这些字符串编辑为:
storyBoardName = Storyboard的名称。
storyBoardID = 您的 ViewController 的 StoryBoardID。
其他信息
如何获取 Storyboard名称?
如果您的 StoryBoard 名为 Main.storyboard
Main 就是标题。
如果你的 StoryBoard 叫做 MyName.storyboard
MyName 就是标题
如何设置 StoryBoardID?
选择您的 View Controller 。您的 View 现在必须突出显示为蓝色。转到身份检查器,在身份下您会找到 StoryBoardID。将其设置为您喜欢的任何值。
如果在您使用此代码时它仍然不起作用,则说明您输入了错误的变量,或者存在未知错误。
关于iOS GameOver 画面不出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30662335/