You might be fine if you do not present a modal view controller, but use the UIViewController , which controls the underlying view controllers.
Similar to this:
// MainNavigationController extends UINavigationController @property (nonatomic,retain) UIViewController childViewController -(void)viewDidLoad { self.childViewController = [MenuViewController alloc] initWithNibName...]; [self pushViewController:childView...]; } -(void)launchGame { self.childViewController = [GameViewController alloc] ... ]; self.viewControllers = [NSArray array]; [self pushViewController:childView...]; }
Thus, you constantly keep a link to your current view controller and control the display of them in one place.
You must also pass the reference to the MainNavigationController to the child view controllers so that you can use the delegate methods.
change
To talk a little about the first comment: Yes, MainNavigationController is the starting point of your application, which handles the display of the menu and the game itself.
The string self.viewControllers = [NSArray array] used to simply issue a list of the current view controllers when the game starts. This is done in order to replace the menu with a game, and not just click on it. Thus, you do not have 8 view controllers when the user goes to the menu, the game, the menu, and so on.
A similar method will be used to open the menu during the game: the button will prompt MainViewController to open the menu. You can do it the same way the launchGame method launchGame , or you can present it in a modal way to save the state of the game, or you put a smaller game menu before that or something else - many ways to handle things from there.
Sebastian wramba
source share