0
votes

The Problem

I'm relatively new to Swift and I'm trying to build an application that makes use of a UITabBarController.

What I'm trying to do is put a different navigation bar (or UINavigationItem) on each of the tabs in the UITabBarController.

For example, I want the UINavigationItem I set, with its bar button items, to appear on MyViewController instead of a back button to the previous view controller, such as shown on the image below.

Back Button

The current layout on the Storyboard is as follows.

Storyboard

MyViewController on the sidebar:

Breakdown of MyViewController

What I've Tried

Someone suggested that I should embed each UIViewController (e.g. MyViewController) in a Navigation Controller. I've tried this and it doesn't work.

I've also tried to set the Top Bar to "None" in the Attributes tab of the options menu.

Attributes

Thank you in advance for your help.

1

1 Answers

0
votes

Here is how i did it,

UINavigationController -> UITabbarController

And then each "Tab" is in different Storyboard and every storyboard start with a "Navigation Controller". So yes every tab in different navigation controller this how you should do it.

Different storyboards because may be multiple people work on storyboard at same time.

Why TabbarController inside Navigationcontroller ?

I put the "TabbarController" inside "NavigationController" because some of the controllers i want them to be full screen, like hiding the "Tabbar" so for that i push them from main NavigationController.

//Out of context but may help you, I have created an "Extension" of Navigation Controller to push a view controller on main navigation so that any of the tabbars (which are also inside navigation controllers) can easily use the extension to push any view controller if want to hide the tabbar.