I’m trying to build an educational app that will have approximately 3-5 completely different pages/screens. Each screen contains one puzzle and each puzzle is independent of all the other puzzles (screens). Once the puzzle on the current screen is solved I’d like to transition to a new (randomly selected) screen. I would allow the same puzzle to be shown multiple times, however, if it had been displayed before it would need to be reset.
I’ve tried doing this using segues but that seems to require a UINavigationController which is not the experience I want to present (since it requires a predefined hierarchy of screens).
I assume the best way to do this is to have each screen as completely separate UIViewControllers, correct? I’m just not sure how to orchestrate the navigation/rendering between them.
I’d appreciate whatever best practices you know of. Thanks!
Well here is a possible option:
First of all if you want a menu outside of these puzzles have that as your root view controller in a
UINavigationController.Then create a launcher controller and add it to the navigation controller when appropriate. This will be a regular
UIViewControllerexcept in this controller in theviewWillAppearmethod have it pick a random number 0-5 and run it through a switch and depending on the number push one of your 5 view controllers. Then when the puzzle is completed callpopViewControlleron the navigation controller. Now when it pops back,viewWillAppearwill be called again and randomly push another. Then if you want to go back to the main menu at any time just callpopToRootViewControllerAnimated. This should do what you need. And to make it so it doesn’t animate twice either only have the push animate or only the pop.