0

I have a stack like below hierarchy (I'm using programatic way, so I done it)

UINavigationController -> UITabbarController -> UInavigationController -> UIViewController
                                             -> UInavigationController -> UIViewController

As Apple Docs say for pushViewController:

The view controller to push onto the stack. This object cannot be a tab bar controller

I need to know If this has a known bug or will CERTAINLY causes a bug.

I really searched a lot for similar posts but none of them give me an acceptable answer. Using UITabBarController with UINavigationController - Swift 3

Can you push a UITabBarController inside an UINavigationController

Emre Önder
  • 2,408
  • 2
  • 23
  • 73

1 Answers1

2

From Apple:

Before creating a tab bar interface, you need to decide how you intend to use a tab bar interface. Because it imposes an overarching organization on your data,you should use one only in these specific ways:

  • Install it directly as a window’s root view controller.
  • Install it as one of the two view controllers in a split view interface. (iPad only)
  • Present it modally from another view controller.
  • Display it from a popover. (iPad only)

Installing a tab bar interface in your app’s main window is by far the most common way to use it. In such a scenario, the tab bar interface provides the fundamental organizing principle for your app’s data, with each tab leading the user to a distinct part of the app. You can use tab bar controllers by themselves or in conjunction with other view controllers to create even more sophisticated interfaces. For more information, see Combined View Controller Interfaces.

It is also possible to present a tab bar controller modally if a very specific need makes doing so worthwhile. For example, you could present a tab bar controller modally in order to edit some complex data set that had several distinct sets of options. Because a modal view fills all or most of the screen (depending on the device), the presence of the tab bar would simply reflect the choices available for viewing or editing the modally presented data. Avoid using a tab bar in this way if a simpler design approach is available.

  • Thank you for the reference. I still curious about why we can't use it. – Emre Önder Feb 25 '19 at 12:08
  • As it says you can use it, but it is not recommended by apple. Most of the apple users are used to have the tab bar as the root controller. – Pankaj Teckchandani Feb 25 '19 at 12:10
  • As I understand they say "u can use it but we don't recommend it" for presenting tab bar modally. In my case, I use pushViewController and in pushViewController's doc It says "you cannot" – Emre Önder Feb 25 '19 at 12:14