iOS 8 UINavigationBar与状态栏重叠

iOS 8 UINavigationBar与状态栏重叠,ios,swift,uistatusbar,Ios,Swift,Uistatusbar,我的主控制器中有一个视图(contentView),其中包含另一个UINavigationViewController(mainNavigationController)的视图。完全适合屏幕(参见图1) 然后我编写了一个函数,将contentView的视图更改为另一个UINavigationViewController的视图: func moveToNC(NCName:String) { let incomingViewController = UINavigationControll

我的主控制器中有一个视图(contentView),其中包含另一个UINavigationViewController(mainNavigationController)的视图。完全适合屏幕(参见图1)

然后我编写了一个函数,将contentView的视图更改为另一个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)

}
InMingNavigationController的导航栏变小(参见图2):( 我想是因为状态栏

使用UIBarPositionDelegate的解决方案没有帮助:(

谢谢你的帮助

解决了

问题是当视图被缩放时,我改变了视图(参见图3)。首先我应该移除缩放,然后改变视图