Switching between 2 UINavigationControllers
Posted
by Smikey
on Stack Overflow
See other posts from Stack Overflow
or by Smikey
Published on 2010-05-06T10:10:19Z
Indexed on
2010/05/06
10:18 UTC
Read the original article
Hit count: 173
Hi all,
I seem to have a problem switching between 2 UINavigationControllers, i.e. one which controls the main (selection) menu of my application, and the second which controls the main session (i.e. the user can't go back to the selection menu once they're started a new session).
The first works just fine, but I get into trouble when trying to load the second. I have a class called GameViewController which contains the second UINavigationController instance. I set this up as usual, linking it as an IBOutlet to the delegate and setting up the NavController in the GameViewController.xib file with its 'Class' property pointing at GameScreenViewController (my main game screen), and its NIB Name property pointing to the GameScreenViewController nib file. I then create a new instance of GameViewController and load it.
In IB, the navigation controller looks fine, with its View 'loaded from "GameScreenViewController"', however when the NavigationController is loaded in the game, it actually loads the GameViewController's UIWindow instance (just a blank window).
I'm not sure how to make it load the Navigation Controller's view rather than its own window?
Also, another quick question. When I load the second navigation controller from the first, which makes more sense to use:
[self.view addSubview:gameViewController.view];
or
[self presentModalViewController:gameViewController animated:YES];
Thanks for any help, much appreciated :D
Michael
© Stack Overflow or respective owner