Monotouch设置状态栏隐藏 - API更改安全 [英] Monotouch set status bar Hidden - API change secure

查看:107
本文介绍了Monotouch设置状态栏隐藏 - API更改安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Monotouch应用程序中隐藏状态栏,使其在iOS 3.X上向后兼容,同时在iOS> = 4.X上进行开发?

How can I hide the status bar in a Monotouch application in such a way that it is backwards compatible on iOS 3.X while developing on iOS >= 4.X?

推荐答案

如果您需要在Monotouch应用程序中隐藏状态栏,并希望在iOS SDK 4上进行开发时对OS 3.X上向后兼容的代码进行正确操作.X以及更新的设备,这里是答案:

If you ever needed to set the status bar hidden in Monotouch App, and wanted to do it properly for code that runs backward compatible on OS 3.X while developing on iOS SDK 4.X and also for newer devices, here is the answer:

if (UIApplication.SharedApplication.RespondsToSelector(new Selector("setStatusBarHidden: withAnimation:")))
    UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade);
else
    UIApplication.SharedApplication.SetStatusBarHidden(true, true);

这篇关于Monotouch设置状态栏隐藏 - API更改安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆