views:

230

answers:

1

Hi, in my application the first view is an UIView with a couple of uilabel and an uibutton to do the login. I would to show an uinavigationcontroller with a table after the login, so with the action of the button. I know how to set up a working Navigation Controller starting with the Xcode Template but i dont know how to load this as a "Second View"

Any help?

+2  A: 

You can add the view of the UINavigationController to the UIWindow and either let it obscure the first view or remove that view from the UIWindow. The navigationController won't have a back button to take you back to the first view (since it's stack doesn't include the first controller), so you'll need a custom button if you want to provide a way back.

- (IBAction) buttonPressed {
    myNavigationController = [[UINavigationController alloc] initWithRootViewController:mySecondViewController];
    [self.view.window addSubview:myNavigationController.view];
    [self.view removeFromSuperview];
}

That's the direct answer to your question, however, if you simply want UINavigationController functionality but don't want to see the UINavigationBar on the first screen - check out:

http://stackoverflow.com/questions/1298892/hiding-the-uinavigationbar-only-for-the-root-uiviewcontroller

dbarker