Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the status bar programmatically in iOS 7?

In ios7, how can I hide the statusbar programmatically? I am using XCode 4.6.1 (ios6.1) and I want to implement this in XCode itself.

like image 953
Magesh Avatar asked Sep 28 '13 14:09

Magesh


People also ask

How do I hide the status bar on my Iphone?

Go to Your info. plist file. Add a key called “View controller-based status bar appearance” and set its value to NO.

What is the IOS status bar?

A status bar appears along the upper edge of the screen and displays information about the device's current state, like the time, cellular carrier, and battery level.


2 Answers

in iOS7 you should implement in your viewController

- (BOOL)prefersStatusBarHidden {     return YES; } 
like image 152
Nicolas Manzini Avatar answered Oct 01 '22 05:10

Nicolas Manzini


you can hide status bar to set the key value "View controller-based status bar appearance" NO in plist. This is easiest way.

or You can hide in code by using property statusBarHidden of UIApplication class.

[[UIApplication sharedApplication] setStatusBarHidden:YES]; 

Swift 3.0

Hide status bar for any particular view controller

override var prefersStatusBarHidden: Bool {     get {         return true     } } 

Hide Status bas across the application

UIApplication.shared.isStatusBarHidden = true

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

like image 24
Anand Mishra Avatar answered Oct 01 '22 07:10

Anand Mishra