开发者

2D Non-OpenGL Game : ViewControllers

开发者 https://www.devze.com 2023-04-09 17:23 出处:网络
I\'m building a very simple iOS game that doesn\'t require any OpenGL; I\'d like to stick with Core Graphics & Core Animation.

I'm building a very simple iOS game that doesn't require any OpenGL; I'd like to stick with Core Graphics & Core Animation.

It seems as though I need two types of ViewControllers: Basi开发者_StackOverflow社区c VCs for navigating between menu screens (ie. Settings, Main Menu, Level Select, etc.), and Gameplay VCs for managing all my UIViews and CALayers.

What's a good way to manage/exchange these Views & VCs to preserve performance? Is it best practice to have one hierarchy of VCs like a traditional UINavigationController-based app, covering the NavBar when I'm displaying a Game VC? Or instead should I be removing all other ViewControllers from the stack when I enter "game mode", and setting it as my window.rootViewController property? Any alternatives / downsides to continually resetting window.rootViewController?

My gut tells me the latter is better on resources+performance, but it seems heavy handed. Any advice + direction here would be appreciated.

Thanks


You can probably make the Game VC the rootViewController, and present the game selection as modal view controller on top of that controller. You can do that without animating at the beginning of the application. When the user is done with the setup, dismiss the view controller.

0

精彩评论

暂无评论...
验证码 换一张
取 消