我正在使用Monotouch和MonoGame为iOS开发游戏,需要将游戏设置为全屏,不显示状态栏。在iOS 6中,这不是问题,但在iOS 7中,我无法找到如何禁用状态栏的方法。我已经在Objective-C中找到了解决方法,但无法在Monotouch中找到。这篇文章说这是不可能的,但Netflix iOS 7应用程序在播放视频时可以实现全屏且没有状态栏。
在 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>
我已经弄清了这个问题,我不知道是否需要所有这些内容才能使其工作,但这就是我所做的。
In iOSGameViewController I added:
public override bool PrefersStatusBarHidden ()
{
return true;
}
现在游戏中没有显示状态栏。