I am a newbi in iPhone development.I want to build an app which will have a UIViewController first , which will have a button.Now on clicking the button, it shud load a UINavigation controller. Here is how i m approaching :

i created a UIViewController class, where i took a

-(IBAction) PressMeFunc:(id) sender

for the button to be pressed.

Then i created a UIView xib file.I did the required steps in the IB.

Then in the AppDelegate, i added the ViewController's instance as a Subview of the window.

Upto this it is OK.

Next, how do i load a navigationcontroller on the press of the button?

I know how to build a navigationController project from window-based app, but i am having a tough time doing NavigationController as a subview of UIView.

2 Answers
2

The NavigationController is designed to take over the screen when it's used, so you have to decide how to manage the transition to the NavigationController from your original ViewController. You can do this with presentModalViewController, or by handling removing your original view and swapping the NavigationController in programatically.

Thank you Mark for your quick reply. I have downloaded the Apple doc that you have mentioned. I will go through it and try to load NavigationController from UIViewController;though i dont know what presentModalViewController is. Actually i want to load an xml in NavigationController on clicking a Button which is in UIViewController. regards, Xcodermi2
–
XcoderMi2May 1 '09 at 18:43

2

this is a shame of Apple, there are a lot of issues unless you only add uinavigationcontroller's to the main window, they could have at least made a note in the docs
–
valexaAug 19 '10 at 13:23

You can also add it as a modal view controller as was suggested here, or you can make the first view controller a navigation controller, and onto that navigation controller's stack, push the 2nd navigation controller: