iOS 8 UINavigationBar 与 StatusBar 重叠

标签 ios swift uistatusbar

我的 MainController 中有一个 View (contentView),其中包含另一个 UINavigationViewController (mainNavigationController) 的 View 。完美贴合屏幕(参见图 1)。

然后我编写了一个函数来将 contentView 的 View 更改为另一个 UINavigationViewController 的 View :

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)

}

传入导航 Controller 的导航栏变小(参见图 2):( 我想是因为 StatusBar。

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

感谢您的帮助!

image 1 image 2

最佳答案

解决了!

问题是我在缩放时更改了 View 。 (见图 3)。首先我应该删除比例,然后更改 View 。

enter image description here

关于iOS 8 UINavigationBar 与 StatusBar 重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35186981/

相关文章:

ios - 在 tabitem 单击时以编程方式加载 navigationController

ios - 检测是否以特定时间间隔按下 UIButton

ios - 由于某种原因,状态栏字体是粗体

ios - 在不缩小内容的情况下调整 Sprite 大小

Swift - scheduledTimerWithTimeInterval - NSInvocation

swift - 更改背景颜色状态栏 iOS

ios - 如何在 iOS 6.0 中使用隐藏的导航 Controller 更改状态栏色调颜色?

ios - 我从哪里开始在 main.m 第 15 行中寻找 SIGSEGV 的原因

ios - ActionScript3.0 - 如何获取坐标处像素的颜色 (uint)? (Stage3D, Flare3D)

ios - 动态更改表格 View 单元格的高度