隐藏状态栏

发布于 2024-09-29 01:55:03 字数 238 浏览 0 评论 0原文

我希望将我的应用程序中的 ViewController 之一的视图显示为全屏,因此在 Interface Builder 中,我将状态栏设置为 None。 我还将视图框架的大小调整为 320*480,

但是当我运行应用程序时,视图控制器的视图仍然显示状态栏。

欢迎任何评论,

谢谢

alt text

I hope to display the view of one of ViewControllers in my app as full screen , so in Interface Builder, I set the statusbar as None.
I also resize the frame of view as 320*480

but when I run the app, the view of the viewcontroller still displays the statusbar.

Welcome any comment

thanks

alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

请远离我 2024-10-06 01:55:03

在 [UIApplication sharedApplication] 上调用 setStatusBarHidden:withAnimation:。

Call setStatusBarHidden:withAnimation: on [UIApplication sharedApplication].

傲影 2024-10-06 01:55:03

解决这个问题并不难。在您的项目设置plist文件中,选中“状态栏最初隐藏”键,状态栏将从启动中删除。

it is not diffult to solve the problem. In your project setting plist file, check the key"Status bar is initially hidden", status bar will be removed from startup.

坐在坟头思考人生 2024-10-06 01:55:03

您需要将视图控制器的 wantsFullScreenLayout 设置为 YES。让您的 xib 文件与屏幕一样大,并在您的 viewDidLoad 中进行设置。

想要全屏布局

一个布尔值,指示视图是否应与状态重叠
酒吧。

@property(非原子,分配)BOOL想要FullScreenLayout

讨论

当视图控制器呈现其视图时,它通常会缩小该视图
视图,使其框架不与设备的状态栏重叠。
将此属性设置为 YES 会导致视图控制器调整其大小
视图,使其填满整个屏幕,包括
状态栏。 (当然,要发生这种情况,托管窗口
视图控制器本身必须调整大小以填充整个屏幕,
包括状态栏下方的区域。)您通常会设置
如果您有半透明状态栏,则将此属性设置为 YES
并希望您的视图内容在该视图后面可见。

如果此属性为“是”,则视图不会以以下方式调整大小:
使其与选项卡栏重叠,但调整大小以使其与半透明重叠
工具栏。无论此属性的值如何,导航
控制器始终允许视图重叠半透明导航
酒吧。

该属性的默认值为NO,这会导致视图
布局使其不会与状态栏重叠。

可用性 适用于 iOS 3.0 及更高版本。

声明于

UIViewController.h

You need to set your view controller's wantsFullScreenLayout to YES. Make your xib file as big as the screen and set this in your viewDidLoad.

wantsFullScreenLayout

A Boolean value indicating whether the view should underlap the status
bar.

@property(nonatomic, assign) BOOL wantsFullScreenLayout

Discussion

When a view controller presents its view, it normally shrinks that
view so that its frame does not overlap the device’s status bar.
Setting this property to YES causes the view controller to size its
view so that it fills the entire screen, including the area under the
status bar. (Of course, for this to happen, the window hosting the
view controller must itself be sized to fill the entire screen,
including the area underneath the status bar.) You would typically set
this property to YES in cases where you have a translucent status bar
and want your view’s content to be visible behind that view.

If this property is YES, the view is not resized in a way that would
cause it to underlap a tab bar but is resized to underlap translucent
toolbars. Regardless of the value of this property, navigation
controllers always allow views to underlap translucent navigation
bars.

The default value of this property is NO, which causes the view to be
laid out so it does not underlap the status bar.

Availability Available in iOS 3.0 and later.

Declared In

UIViewController.h

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文