I am currently working on a new feature which is presented like this :
The whole content is a Container View, in order to change the content by playing with the Segmented Control. I have 2 other UIViewController (for the first and second content).
Obviously embedded in a Navigation Controller.
My issue is that I can't put down the Segmented Control, I mean outside of the Navigation Bar.
If I bring it down, it appears hidden.
Here is some code of my main View Controller (the one containing the container view) :
private func addViewControllerAsChildViewController(childViewController: UIViewController) {
view.addSubview(childViewController.view)
childViewController.view.frame = view.bounds
childViewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
private func removeViewControllerAsChildViewController(childViewController: UIViewController) {
childViewController.willMove(toParentViewController: nil)
childViewController.view.removeFromSuperview()
childViewController.removeFromParentViewController()
}
What I am doing is after I instantiate my 2 ViewControllers (first and second), I add them as child View Controller.
How can I handle the Segmented Control without ruining all my logic and my design, I mean make it visible outside of the navigation bar.