Search code examples
iphoneobjective-cuiviewcontrolleruinavigationcontrollerios6

How to add back button when we have three UIViewControllers


I am learning Navigation controller from this link.

I have created it as per this link. However, now what I want is add one more UIViewController before first where I will have a button as My Recipe Book. When I click on this button, I will see the first screen that is there in the example. When I see the second screen (where I will have a list of items (screen 1 in example)), the Navigation bar should have a back button like what I have in above the example in the second screen.

Any idea how to get this done?

I tried adding new UIViewController and adding navigation controller and connecting this UIViewController to first UIViewController in example with MODAL.

It works, however I don't see back button.


Solution

  • I got the answer... Yes I made it finally...

    I added new UIViewController and linked this new UIViewController to Navigation controller that is already present.

    Earlier :

    Navigation Controller >> UIViewController 1 >> UIViewController 2
    

    What I was trying, which was not working

    Navigation Controller >> New UIViewController >> Navigation Controller >> UIViewController 1 >> UIViewController 2
    

    Below is what is working

    Navigation Controller >> New UIViewController >> UIViewController 1 >> UIViewController 2