Frage

I'm building a very simple iOS game that doesn't require any fancy OpenGL; I'd like to stick with Core Graphics & Core Animation. I'd like to make this a fullscreen game, and my question is of ViewController hierarchy + management:

It seems as though I should have two types of ViewControllers: Basic 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 these? 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 ViewController? 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 advice + direction here would be appreciated.

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
scroll top