简体   繁体   中英

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.

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

set title to each view controller's viewDidLoad method using....

    [self setTitle:@"myViewController"];

and if navigation bar is hidden then make it visible using ......

[self.navigationController setNavigationBarHidden:NO];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM