更改 iPhone 应用程序状态栏属性
我的应用程序将是全屏的,但我无法找到解释如何更改状态栏属性的文档。
如何更改状态栏属性?
My app will be full screen, but I am having trouble finding the document that explains how to change the status bar properties.
How can I change the status bar properties?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
[[UIApplicationsharedApplication]setStatusBarHidden:YESanimated:NO]
应该隐藏状态栏。 那是你要的吗?编辑:您还可以将以下内容添加到
Info.plist
中:[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]
should hide the status bar. Is that what you want?edit: You could also add the following to
Info.plist
:状态栏 API 是 UIApplication 类的一部分。 从那里开始。
The status bar APIs are part of the UIApplication class. Start there.
使用 Snow Leopard 和 XCode 3.2,您只需编辑 Apps Info.plist 即可。
添加 2 行:
右键单击打开的 plist 并添加一行,然后从下拉列表中选择“状态栏最初隐藏”。
选中右侧列中提供的复选框。
添加另一行并从下拉列表中选择“状态栏样式”。
在右侧的列中键入 UIStatusBarHidden
这对我有用。 不过,我还没有尝试过在运行时更改状态栏视图状态,例如电池电量低时。
如果您添加第二行的值,我并不完全确定这两个值都是需要的。
// :)
Using Snow Leopard and the XCode 3.2, you simply edit the Apps Info.plist.
Add 2 rows:
Right click the open plist and add a row and select "Status bar is initially hidden" from the drop down list.
Check the checkbox it provides in the column to the right.
Add another row and select "Status Bar Style" from the drop down list.
In the column to the right type in UIStatusBarHidden
That works for me. I haven't experimented yet with changing the status bar view state at runtime though, say for example if the battery gets low.
And I'm not entirely sure that both values are needed if you add the second row's value.
// :)
由于旧方法已被弃用:
iOS 3.2+ 方法是
动画选项为:
您仍然可以使用 iOS 2.0+ 方法,没有动画:
Since the old way has been deprecated:
The iOS 3.2+ way is
The animation options are:
And you can still do it the iOS 2.0+ way, with no animation: