1

I noticed that WhatsApp has a somewhat neat navigation behaviour on their iOS app. See the following:

enter image description here

There are two navigation stack behaviour here:

  1. UINavigationController as a child of UITabBarController
  2. UITabBarController as a child of UINavigationController

How to achieve both of this at the same time, just like WhatsApp? Does it uses a custom UINavigationController?

Currently my implementation only does number 2 and not number 1. I do know that to do number 1 I have to make the UINavigationController as a child of UITabBarController, but I will lose number 2.

However if I implemented both, I will get weird result where I get two navigation bar, like:

enter image description here

Dan
  • 810
  • 2
  • 11
  • 29

1 Answers1

1

In the example you give, it looks like they have a UITabBarController as the root view controller. Settings is a view controller inside a navigation controller.

When you tap Data & Storage, it pushes another view controller on to the Settings nav controller's stack.

When you press Help it does the same - but the tab bar is hidden when the Help view controller is pushed on the stack.

See hide / show tab bar when push / back. swift for some ways to do this

Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
  • 1
    Tested and works just like WhatsApp! I knew about `hidesBottomBarWhenPushed` but thought it (the tab bar) would do a slide down animation and not as the original push animation, so I bailed it . I have to do more testing on the hierarchy of the navigation stack for this implementation, and make this as a subclass of `UIViewController`. – Dan Nov 05 '18 at 11:46