如何在游戏开始或中断时实现额外的视图
我想实现一个具有“恢复”、“保存”和“退出”按钮的视图,并在游戏开始或中断时弹出。我查了几本书,大多数都提到了视图转换的动画或建议使用标签栏控制器等,所有这些都不适合我的游戏需求。我想知道:
1)如何实施?比如如何声明、如何调用以及在哪里调用?只需使用 .xib 文件创建另一个 ViewController 类?然后呢?只需将其作为子视图添加到委托文件中的窗口中,例如 [window addSubview:viewController.view];?
2) 如何让它出现在启动介绍画面之后、游戏开始之前?
3) 如何让它在游戏暂停时出现在游戏顶部?
4)如何让它恢复时消失?
I want to implement a view on which has "resume", "save" and "quit" buttons and it popups when the game is started or interrupted. I looked up a few books and most just mentioned animation of view's transition or suggested using tab bar controller, etc and all these are not applicable to my game's need. I would like to know:
1) How to implement it? Such as how to declare, how to call and and where it is called? Just create another ViewController class with .xib file? Then what? Just add it as a subview to window in delegate file like [window addSubview:viewController.view];?
2) How to make it appear after the startup intro screen and before the game starts?
3) How to make it appear on top of the game when the game is paused?
4) How to make it disappear when it is resumed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将创建一个单独的视图控制器并使用
-presentModalViewController:animated:
显示它。I would create a separate view controller and display it with
-presentModalViewController:animated:
.