Getting at the UINavigationController to display new level

Discussion in 'iOS Programming' started by tutiplain, Apr 14, 2011.

  1. macrumors member

    Feb 4, 2011
    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.
  2. macrumors 6502


    Jan 21, 2011
    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.
  3. macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    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 :)

Share This Page