Segue from Tab controller MORE issue

205 Views Asked by At

I have a tab controller that has 7 tabs on.

I am on a page called Device. The back button shows "< Devices"

Segue from any of the 4 tabs in view and the destination back button says "< Device" which is what I would expect.

If I however, click on the tab "MORE" button and select a tab from there called "Manage", if it segues to another view, the back button still says "< Devices", and the page header still says "Device".

If I reorder the tabs so the "Manage" isn't in the MORE (it is one of the 4 visible), if I click on the tab directly, it moves to the view, the header says "Manage" and the back button displays "< Device" as I would expect.

Why does a segue from the tab controller MORE menu behave differently to a seque from a visible tab?

1

There are 1 best solutions below

0
Radim Halfar On

As by apple design guidelines, the tab bar controller should be used as top most navigation in your app.

If there is some reason why not to use it. If you are using navigation controller you should use separate navigation controller for each flow. You can embed your controllers in UINavigationController by choosing

Editor -> Embed in -> UINavigationController

If your setup is TabBarController -> ChildViewController [Each of these embedded in UINavigationController] it should behave correctly

But as for your description the setup is likely

UINavigationController -> UIViewController (title "Devices") -> UITabBarController -> ChildViewController

The MORE tab is specific. Refer to tabbarController.moreNavigationController

The reason why you are not seeing your title in Manage tab is that the view hierarchy is different. As you did not mentioned how you are setting your title to navigationItem. there are two possibilities.

Call the below snippet in your Manage VC viewDidAppear method

self.tabBarController?.navigationItem.title

You can also refer to similar questions about tab bar controller. This is mostly about using it (Nothing to do with MORE) Stackoverflow - Tab bar controller

To answer your question - The behavior is different due to different view hierarchy. The Child VC within More tab is embedded in UINavigationController respectively to UITabBarControllers property moreNavigationViewController.