How to implement both UIViewController stack behaviour

3002 views swift
-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

answered question

1 Answer

13

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

posted this

Have an answer?

JD

Please login first before posting an answer.