【问题标题】:Remove iOS 7 Status Bar [closed]删除 iOS 7 状态栏 [关闭]
【发布时间】:2013-11-17 20:31:56
【问题描述】:

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

This 帖子说这是不可能的,但 Netflix iOS 7 应用程序有全屏,没有状态栏(在播放视频时)。

【问题讨论】:

  • 有人对这个问题投了反对票,如果您对我提出问题的方式有任何反馈,请告诉我,在没有任何反馈的情况下投反对票对任何人都没有帮助。
  • 他们的用户没有要求代码,他请求帮助以“弄清楚如何”,为以前尝试失败的解决方案提供参考和链接。

标签: ios xamarin.ios ios7 statusbar monogame


【解决方案1】:

将此添加到您的 info.plist 中的 dict 标记之前

<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>

【讨论】:

  • 这行得通,以及我上面的答案。谢谢!
【解决方案2】:

我想通了,我不知道是否需要所有这些东西才能完成这项工作,但这就是我所做的,

  1. 我在 info.plist 中添加了布尔值“是”的“状态栏最初是隐藏的”
  2. 我在 info.plist 中添加了布尔值“No”的“UIViewControllerBasedStatusBarApp”
  3. 在 iOSGameViewController 我添加了:

    public override bool PrefersStatusBarHidden ()
    {
        return true;
    }
    

现在游戏中不显示状态栏了。

【讨论】:

  • 这很好 - 我们不需要其他 plist 更改。
猜你喜欢
  • 1970-01-01
  • 2015-01-22
  • 2014-02-20
  • 2014-02-20
  • 1970-01-01
  • 2013-08-14
  • 2015-06-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多