删除iOS 7状态栏

wea*_*9x9 10 statusbar xamarin.ios ios monogame ios7

我正在使用Monotouch和MonoGame为iOS开发游戏,我需要在没有状态栏的情况下全屏制作游戏.在iOS 6中这不是问题,但在iOS 7中我无法弄清楚如何禁用状态栏.我在Objective-C中找到了如何执行此操作的结果,但无法在MonoTouch中找到如何执行此操作的结果.

这篇文章说这是不可能的,但Netflix iOS 7应用程序全屏,没有状态栏(播放视频时).

Xua*_*uan 16

在dict标记之前将其添加到info.plist中

<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
Run Code Online (Sandbox Code Playgroud)

例:

.....
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIStatusBarHidden</key>
    <true/>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
Run Code Online (Sandbox Code Playgroud)


wea*_*9x9 8

我想出来了,我不知道所有这些事情是否都是必要的,但这就是我所做的,

  1. 我在info.plist中添加了"状态栏最初被隐藏",布尔值为"是"
  2. 我在info.plist中添加了带有布尔值"No"的"UIViewControllerBasedStatusBarApp"
  3. 在iOSGameViewController中,我添加了:

    public override bool PrefersStatusBarHidden ()
    {
        return true;
    }
    
    Run Code Online (Sandbox Code Playgroud)

现在状态栏不会显示在游戏中.