Reputation: 1299
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?
Upvotes: 5
Views: 2330
Reputation: 1299
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);
Upvotes: 5