如何从视图中隐藏iphone中的标题栏(顶部栏)

问题描述:


可能重复:

我想从我的第一个欢迎视图和启动画面隐藏iphone中的标题栏,我该如何隐藏它(顶部栏,而不是导航栏)。

I want to hide the title bar in iphone from my first welcome view and also from the splash screen, how can i hide it(top bar, not the navigation bar).

我看到一篇帖子有这个

    [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];

但这会隐藏整个应用程序的标题栏。我只是想从第一个视图中隐藏它。

but this hides the title bar through out the application. I just want to hide it from the first view.

隐藏状态栏的最简单方法是进入youInfo。 plist中;右键单击添加一行并选择状态栏最初隐藏。

The easiest way to hide the status bar is to go into youInfo.plist; right click to add a row and select Status Bar Initially hidden.

这将确保每次启动应用程序时状态栏都将被隐藏。

This will ensure every time you app launches the status bar will be hidden.

编辑

带编程

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
self.navigationController.navigationBar.frame = CGRectMake(0, 0, 320, 44);

如果您想显示状态栏,请使用以下代码..

and when you want to show the statusbar just use bellow code..

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
self.navigationController.navigationBar.frame = CGRectMake(0, 45, 320, 44);

我希望这可以帮到你...

i hope this help you...

:)