How to create a second level UINavigationController - Tutorial Request

Discussion in 'iOS Development' started by cybohemia, Jan 26, 2009.

  1. cybohemia

    cybohemia New Member

    Joined:
    Jan 25, 2009
    Messages:
    49
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    Hi!

    I'd like my first page to be a regular view (some images and buttons) that goes to a second page that is a NavigationController with a TableView (see images below).

    First page:

    Please Register or Log in to view images



    Second page:

    Please Register or Log in to view images



    I'd like to do this with the IB, as I'm trying to learn that too.

    I got kind of close but haven't gotten there yet. I can get a view to go to another view or a NavigationController at the top level but I'm hitting my head against the wall with having the NavigationController only show up after passing through a top level view.

    I've tried a few tutorials that were close but they were either all code (no IB) or they used a NavigationController at the top level, which was a Window App and had a Delegate. (I'm trying to create the second page by starting with a UIViewController which doesn't have a Delegate in the xib.)

    I may be missing something basic or something deep but I'm still fresh to this so I'm not sure.

    If anyone knows how to do this or has seen a tutorial, I'd really appreciate a hand!

    Thanks,
    cybohemia
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    You could do what you want very easily, but I'd recommend just creating a Navigation based project where the entire project is encompassed by a nav controller. Start by adding this into the viewWillAppear method of your Nav Controller's rootViewController:
    Code:
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    And in your button's action selector, add this:
    Code:
    [self.navigationController pushToViewController:yourListViewController animated:YES];
    [self.navigationController setNavigationBarHidden:NO animated:YES];

    You can always pop back to your root view controller (or main menu, as this case seems to be) by calling:
    Code:
    [self.navigationController popToRootViewControllerAnimated:YES];
  3. cybohemia

    cybohemia New Member

    Joined:
    Jan 25, 2009
    Messages:
    49
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    I was hoping to have something other than a Navigation project to begin with so I can have a clean splash screen but I'll give this a go. Thanks, SkylarEC!
  4. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    I am currently against pushing/popping navigation controllers that you don't have to (without them being constrained to a UITabBarController). Currently, there is a bug in the SDK that causes the UINavigationBar to leak its UINavigationBar when popped off.

    Note, I am note referring to pushing/popping view controllers within a navigation controller.
  5. bossman696

    bossman696 New Member

    Joined:
    Sep 12, 2010
    Messages:
    1
    Likes Received:
    0
    How easily can it be down?

    How would this be implemented using the current set up he mentioned? I too have this very issue and would like to way the options of using a second level Navigation Controller in a window or view based project.

    Any help would be greatly appreciated!

    Thanks,

    BossMan696

Share This Page