Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monotouch set status bar Hidden - API change secure

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?

like image 236
Pavel Sich Avatar asked Nov 01 '10 10:11

Pavel Sich


1 Answers

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);
like image 158
Pavel Sich Avatar answered Sep 23 '22 23:09

Pavel Sich