移除iOS 7状态栏

10
我正在使用Monotouch和MonoGame为iOS开发游戏,需要将游戏设置为全屏,不显示状态栏。在iOS 6中,这不是问题,但在iOS 7中,我无法找到如何禁用状态栏的方法。我已经在Objective-C中找到了解决方法,但无法在Monotouch中找到。这篇文章说这是不可能的,但Netflix iOS 7应用程序在播放视频时可以实现全屏且没有状态栏。

3
有人对这个问题进行了负评,如果你对我提问的方式有任何反馈,请让我知道,仅仅是下票而没有任何反馈并不对任何人有帮助。 - weaverx9x9
用户并没有要求代码,他请求帮助“弄清楚如何做”,并提供了之前尝试但未成功的参考和链接。 - Daniele D.
2个回答

17

在 dict 标签之前将此内容添加到您的 info.plist 文件中

<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

例子:

.....
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIStatusBarHidden</key>
    <true/>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>

这个可以运行,就像我之前的回答一样。谢谢! - weaverx9x9

8

我已经弄清了这个问题,我不知道是否需要所有这些内容才能使其工作,但这就是我所做的。

  1. I added "Status bar is initially hidden" with boolean value "Yes" to the info.plist
  2. I added "UIViewControllerBasedStatusBarApp" with boolean value "No" to the info.plist
  3. In iOSGameViewController I added:

    public override bool PrefersStatusBarHidden ()
    {
        return true;
    }
    

现在游戏中没有显示状态栏。


1
这个很好用 - 我们不需要其他的plist更改。 - Ender2050

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接