Search code examples
iosswiftuistatusbar

iOS 8 UINavigationBar overlaps StatusBar


I have a view (contentView) in my MainController, witch contents a view of another UINavigationViewController (mainNavigationController). Perfectly fit screen (see image 1).

Then i wrote a function to change view of contentView to view of another UINavigationViewController:

func moveToNC(NCName:String) {

    let incomingViewController = UINavigationController(rootViewController: UIViewController())

    addChildViewController(incomingViewController)

    incomingViewController.view.frame = CGRectMake(0, 0, containerView.bounds.width, containerView.bounds.height)
    containerView.addSubview(incomingViewController.view)

    mainNavigationController.view.removeFromSuperview()
    mainNavigationController.removeFromParentViewController()

    incomingViewController.didMoveToParentViewController(self)

}

NavigationBar of incomingNavigationController becomes smaller (see image 2) :( I think because of StatusBar.

Solution with UIBarPositioningDelegate does not help :(

Thanks for help!

image 1 image 2


Solution

  • Solved!

    The problem was that i change view, when it was scaled. (see image 3). First i should remove scale and then change view.

    enter image description here