views:

460

answers:

1

Hey all,

This problem has been driving me nuts all day and there has to be a simple answer.

I need to create a login page that then provides access to a UITableView which will then be controlled by a UINavigationController. The question is how do I get and initially loaded login page (UIViewController - as created by the "View-based Application template)) to load a second page? I have the thing responding to the user interaction fine, it's just the launching of the second page that has got me stumped. Getting one page to navigate to another must be easy, eh?

Any examples around I can read up on? Any help and advice will be truly appreciated.

Zen-C

+2  A: 

You push view controllers onto the navigation controller to navigate.

Usually within the first view controller you have a line like this.

[self.navigationController pushViewController:newPage animated:YES];

Sorry, BTW, this assumes your first view controller is already in a navigation controller. I'd suggest you start with the navigation controller template, and in your first view you can hide the navigation bar if that is a more appropriate look.

Something like this might help

-(void)viewWillAppear:(BOOL)animated {  
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}

-(void)viewWillDisappear:(BOOL)animated {
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}
NWCoder
What I've done is started with the navigation controller template (as you suggested). I then removed the Table View from the RootViewController.xib IB definition and replaced it with a UIView alongside changing the RootViewController interface to inherit from UIViewController. PushingViewController now worked fine. However this left me with wierd nav bar contents (providing a link back to "Root View Controller" that didn't exist). So, I then used your viewWillAppear and viewWillDisapper suggestion to remove the nav bar on the first page and everything looks fine now.Many thanks, NWCoder :-)
Zen-C