4
votes

I am looking to have one Navigation Controller that will be atop multiple Tab Views in a Tab Bar Controller.

This Navigation Controller will have an Info button in the top right that will segue to the same view no matter what view the user is on (VC 1 / 2 / 3).

Here's what I have set up in storyboard so far:

Need to have the Red nav bar accessible on ALL the tabs. The Problem: The red Nav bar is only accessible through "First VC."

What I need: I need the red Nav bar to be accessible through ALL the tab views. (First VC / VC 1 / VC 2 / VC 3).

What I researched: I read that you can simply embed each tab view in a Navigation Controller. The problem I foresee here is bad re-usability of the navigation bar. That red bar will need to be created 4 times, and each of those 4 buttons will have to link to the same view 4 times.

What is the best approach for having ONE navigation bar that is accessible through ALL the Tab Views.

Thanks.

1
what I would suggest is that you connect different navigation controller for each VC and just write code to change the color of each. You'll find that you would/might want to customize the nav bar ( with different nav buttons ) and it'll be tougher for you to do that if you keep one navigation controller for all of them - John D
@JohnD I can live with having 3 Nav Bars on each VC. But what about the (i) button that should always link to the same view regardless of which VC you're on? (This will be the Settings view of the App.) - Joe

1 Answers

3
votes

This has been resolved. What I ended up doing was embedding EACH VC that has a Tab Bar Item in its own Navigation Controller (in my original post, these are Green VC 2 / Blue VC 3 / Tan VC 4). As @JohnD pointed out in his comment, this gives me much more flexibility on customizing the Nav bar for each tab.

Regarding my Button concern: Each of the nav bars have a settings button. Instead of cluttering up the Main storyboard with multiple segues to the Settings VC, I created a new storyboard. Within this storyboard, I have a Settings View Controller with all the functionality and options needed. The buttons instantiate this new VC with code, as seen in this post: How to push and present to UIViewController programmatically without segue in iOS Swift 3