Search code examples
iphoneobjective-cios7statusbar

iOS : Hide status bar in entire app programmatically not even through plist


I want to hide status bar in my entire app.

Also I know it too, that we can do it by this way :

set the key value "View controller-based status bar appearance" NO in plist.

But I need to do the same only for iOS 7, so of course there need some condition for OS version and as of my knowledge we can not apply any condition in .plist file.

So anyone please suggest some line of code which only hide status bar for iOS 7.

Appreciate on your response.


Solution

  • //Checking iOS version
     float versionOS;
     versionOS=[[[UIDevice currentDevice] systemVersion] floatValue];
      if(versionOS>=7.0)
       {
             [UIApplication sharedApplication].statusBarHidden = YES
       }  
    

    Add this code into application didFinishLaunchingWithOptions method.