0

默认情况下,UINavigationBar 在纵向方向应该是高的,在横向方向应该是短的。大多数时候,我的应用程序的行为是这样的,但有时当从横向更改为纵向时,导航栏无法正确调整大小。是否有强制将导航栏重绘到正确高度的命令?

这是事故的截图。从横向旋转到纵向后,导航栏仍然很短。条形下方有一个永久的空白区域,等于它应有的高度的其余部分。

在此处输入图像描述

我的 UIViewController 有这个相关的方向代码:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

- (BOOL)shouldAutorotate
{
    return YES;
}
4

1 回答 1

-1

它看起来不漂亮,但我只是通过硬编码解决了它:

self.navigationController.navigationBar.height = 44.0;

其中 setHeight 是 UIViews 的一个类别方法,顾名思义,它改变了框架的高度。

于 2013-08-20T22:38:24.727 回答