Are there any problems with this set up:
I have three viewcontrollers
1. main view controller (launched when starting the app)
2. choose level view controller
3. game view controller
I use
[self presentModalViewController:tmpControler animated:YES];
To get from (1) to (2), this is done in the first view controller, the tmpControler is an instance of the choose level controller.
And then I use
GameplayViewController *tmpControler = [[GameplayViewController alloc] initWithNibName:nil bundle:nil];
tmpControler.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
self.window.rootViewController = tmpControler;
[tmpControler release];
To get from (2) to (3), this is done in the application delegate. When I have played the game I want to switch back to (1) by using the same techneque as from (2) to (3). My question is if there are any problems with using presentModalViewController to get from (1) to (2). Is the second view controller on the stack? Since I never use:
[self dismissModalViewControllerAnimated:YES];
to dismiss it.
Is there any smarter way of switching views in this sequence (1->2->3->1) ?
No, that isn’t really a problem. View controllers are relatively lightweight when they’re offscreen (e.g. when covered up by a modal view controller, as you’re doing here); if your app starts running low on available memory, the first view controller will automatically unload its view.