0

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?

jbduzan
  • 1,106
  • 1
  • 14
  • 30
Mike
  • 1
  • 3
  • How are you performing the segue ? Just in storyboard ? Or by code ? Please update with code or screenshot from storyboard. Hard to tell you the answer if we do not see code or your setup. Possible cause can be, that you are using same UINavigationController all the controllers in TabBar. Moreover if I understand it right, you are combining UITabBarController with UINavigationController ? If so, every Controller that represents the tab should have its own Navigation VC. – Radim Halfar Jan 12 '17 at 10:51
  • The storyboard is very large. I have tried performing the seque in code and by storyboard. The result is the same. The behaviour if the navigation bar on the child view controller is different by virtue of the tab position. is the tab is placed on the tab bar, all is fine. If it resides in the "MORE", then the child navigation bar is different. It is as if the MORE view controller is disrupting the child view from being properly popped into the stack. – Mike Jan 12 '17 at 12:39
  • I have tried the tab view controllers both embedded and not embedded in their own navigation controller. It makes no difference. This issue is related to the behaviour of the MORE feature on the tabcontroller it seems. – Mike Jan 12 '17 at 12:42
  • How are you setting the titles for the navigation bar ? – Radim Halfar Jan 13 '17 at 11:03

1 Answers1

0

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.

Community
  • 1
  • 1
Radim Halfar
  • 536
  • 2
  • 6
  • 15