当我将状态栏设置为隐藏或未隐藏时,如何自动调整ios的视图

时间:2011-10-28 06:49:19

标签: iphone ios statusbar resize

当我使用[[UIApplication sharedApplication] setStatusBarHidden:__ animated:__]隐藏状态栏时,我在屏幕顶部有一个空白区域。我知道这是状态栏。如果我只使用一个简单的UIViewController作为我的主视图控制器,我可以将视图的帧设置为(0, 0, 320, 480)以覆盖白色的sapce。但是当我使用UINavigationController时,我不知道该怎么做。

有人都知道吗?如果你没有时间编写代码,请给出一些建议。我可以使用您提供的建议进行一些研究。

提前致谢。

1 个答案:

答案 0 :(得分:0)

我估计您必须访问UINavigationController中currentViewController的视图并修改该视图框架。

NSArray *controllers = [navController viewControllers];

// loop through and find the controller you want

// controller.frame.size.height= newHeight 

您可能还需要更改根视图控制器的视图大小。