View Full Version : Getting at the UINavigationController to display new level

Apr 14, 2011, 11:51 PM
Hi all, I have a project I am trying to configure to use a UINavigationController. I have set up my NIB files as suggested in the Apple developer Docs (in the main window nib). I have also sucessfully managed to display my root view controller (that is, the view controller sitting at the top of the navigation stack. However, I cannot seem to display other levels of information. The reason is that my UINavigationController instance is defined in my App Delegate object, but the root view controller is defined in another class, a custom class inheriting from UIViewController. I don't understand how to display different levels of data unless the navigation interface is defined in the root view controller itself. I know I'm not proving an example of what I'm doing, but hopefully someone can point me in the right direction?

Many thanks for any info.

Apr 15, 2011, 02:48 AM
In your navigation controller window, stick in a button to call this:

SecondLevelController *nextController = [[SecondLevelController alloc] init];
[self.navigationController pushViewController:nextController animated:YES];
[nextController release];

This is all relative to the navigation controller so it doesn't matter where it is defined.

Apr 15, 2011, 02:58 AM
You have to understand the concept of OO programming.
To use that "SecondController" as the guy defined above me, (could be any class (tableview/uiviewController subclasses etc), u have to import this at the top, so u can use it to push it onto the navigation stack :)
Don't forget to give ur first screen a title, otherwise the back button won't display on the second screen.
IF any more questions, go ahead :)