Im having a problem here. Basically within my app I have 4 elements (these 3 bottoms view "buttons" and a top bar-like view) that need to stay in front of EVERYTHING (as in the uppermost index) at ALL TIMES.
I have a series of segues set up that move horizontally to the left or right, and I want the content on these view controller to move left or right with the segue but I need these 3 views to stay static, i.e. not moving, on top.
To accomplish this I created an "overlordviewcontroller" where I add the first view controller programmatically and then make my buttons at the bottom call the segue from that child viewcontrolleR:
controller = storyboard!.instantiateViewControllerWithIdentifier("mainView")
container.addSubview(controller.view)
addChildViewController(controller)
controller.view.frame = self.view.frame
view.addSubview(controller.view)
view.bringSubviewToFront(topBar)
view.bringSubviewToFront(btn1)
view.bringSubviewToFront(btn2)
view.bringSubviewToFront(btn3)
and
controller.performSegueWithIdentifier("toMessageView", sender: controller)
The initial instantiation works great, meaning I have those 4 views on top. Problem is after I call the segue, even if I put this all right after it:
view.bringSubviewToFront(topBar)
view.bringSubviewToFront(btn1)
view.bringSubviewToFront(btn2)
view.bringSubviewToFront(btn3)
These views don't stay static. The 2nd view controller clearly moves in from the right ON TOP OF these elements, ruining the effect. Then once I go back from that view controller to the original, the original is on top and we go all over again.
I have tried using container views like so:
Then putting the first controller as a subview of the container:
container.addSubview(controller.view)
But this had no effect. How can I do this? What do I need to do here?