2

I have a navigation controller with its root view controller, I need to add a fixed/ sticky view at the top of the root view controller, so that only the content below it navigates whenever I use pushViewController or popViewController, is that possible?

Look at the image below, I want the red area to be fixed/sticky a.k.a doesn't navigate or move when I push or pop, only the blue area to navigate

enter image description here

P.S: The containerView won't work here as it acts as normal view, and adds its sub view controller's view to it.

MahmutTariq
  • 217
  • 1
  • 4
  • 17

2 Answers2

0

Add a container View to add as child view controller for your navigation and set navigationBar as hidden. Now you can add the above view with 44 height as a sticky one for all View controllers. If you want a way to communicate between child view controllers under navagtion with the parent I would suggest NSNotification observer or a Delegation to be confirmed by all child VC or by a subclass of UINavigationController. This is a sytematic way.

Other dummy way is to add a view to the window and set the view.layer.zPosition if you want it below or above any other view.

Amber K
  • 700
  • 1
  • 5
  • 20
  • No, I don't know you know it when you add childVC you specically call `addChildViewController()` and view in a separate place. An we know controller always know the view using `self.view`. It works you need to figure it out. – Amber K May 01 '18 at 12:00
-1

you can use Container View and show/hide other views