Hide Status Bar from iPhone application - iphone

I want my app to not have the status bar at all! I have tried using the .plst
I have tried everything in here Status bar won't disappear
and also in here
How to prevent iOS 5 from showing the status bar even though UIStatusBarHidden is YES?
Can someone go into extreme detail to help me? I am using XCode 5 if that helps. I just want the status bar to be gone from the app!
Thanks!

iOS 7
In your Info.plist file add key View controller-based status bar appearance with value NO. And, add key Status bar is initially hidden with value YES.

To hide the status bar after the app has completely launched, change it programmatically by adding this line to your app delegate's applicationDidFinishLaunching method:
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
If you set animated to YES then the status bar will disappear by fading out. One question, why do you want to delete the status bar?

in your "*project_name*-Info.plist" file, add a key named "Status bar is initially hidden" and then set the value to "YES". that will always hide the status bar.

//viewDidload
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:#selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
// Add this Method
- (BOOL)prefersStatusBarHidden
{
return YES;
}

Have you tried this:
click on .xib file -> attribute inspector -> change 'Status Bar' to 'None'
(refer attached image)

Open your application Info.plist file and add the following lines:
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIStatusBarHidden</key>
<true/>

Please add this to your view controller
- (BOOL)prefersStatusBarHidden {
return YES;
}

Related

How to change UIViewControllerBasedStatusBarAppearance to YES/NO programmatically in iOS 7?

My application has a dark background, but in iOS 7 the status bar became transparent. So I can't see anything there, only green battery indicator in the corner. How can I change the status bar text color to Green or Orange like it is on the home screen?
I know about
Set the UIViewControllerBasedStatusBarAppearance to YES in the plist
In viewDidLoad do a [self setNeedsStatusBarAppearanceUpdate];
Add the following method:
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
How can I change UIViewControllerBasedStatusBarAppearance programmatically?
Thanks in advance...
In Info.plist set 'View controller-based status bar appearance' as NO.
then,add this in your appdelegate.m class in didfinishlaunchingwithoptions method.
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
this works for ios 7.
As mention by others add "View controller-based status bar appearance' in your application's info.plist and set it to Type: Boolean and Value: NO
For your ready reference:
In iOS 9
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
method is deprecated.
So you can use this:
application.statusBarStyle = UIStatusBarStyleLightContent;
add this line of code in method
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
which is present in appDelegate.m file. This will change the status bar text color throughout your application.
So if you have any screen which has background may be dark or light then in that screen you can the status bar color by making use of:
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
Hope this helps.

Hiding status bar iOS 7

Can't hide status bar on view controller on ios 7 device.
Already tried setting through plist file and also in Appcontroller.mm but still i doesn't hide the status bar
[[UIApplication sharedApplication] setStatusBarHidden:YES];//Doesn't help
Go to info.plist and add two attributes if not present. set "Status bar is initially hidden" to YES and set UIViewControllerBasedStatusBarAppearance to NO. This will hide status bar for your app.
That's because iOS 7 has changed the way it deals with the status bar.
Setting UIViewControllerBasedStatusBarAppearance to NO on your app Info.plist should work.
I had the same issue recently. Be sure that you are targeting the correct view controller. Try to hide the status bar in the root view controller. Also, I´m implementing the method (BOOL)prefersStatusBarHidden (doc) in my UIViewControllers to hide the status bar. By using this method, you can forward the preferred configuration to a "child view controller". Also, this method works fine in UIViewControllers presented as modal.
// for ios 7
- (BOOL)prefersStatusBarHidden
{
return YES;
}
// for ios 6
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
For iPad (iOS 7.0) need to put another value at Info.plist file.
UIStatusBarHidden boolean value YES.

How to show status bar initially hidden from plist iphone

i want to hide the status bar when i launch my app to view launch image that was covered by status bar. so in plist i added
Status bar is initially hidden YES
and status bar is covered.
My problem is that status bar is covered always in my app, i want to hide status bar only for launch image, what can i do?
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
SOLVED
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
using this at launch of app :)
you can do this by adding property, "Status bar Initially Hidden" to plist as shown below : -
OR
you can also set the (Status bar Initially Hidden)Property to "NO" in Info.plist file in your Application.
Just uncheck this property.
Neither Niko's nor JackTurky's solutions are correct. Niko's:
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
...works but is deprecated. Correct in iOS 3.2 and later is:
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

How to get a black status bar on an iPhone app?

I want to use a black status bar for my iPhone app. I have selected black status bar on all of my .xibs but I still can't get it to be black. Is this an issue that anyone else has seen or knows how to remedy?
Open the "info.plist" file .
Add a new row.
Select "Status bar style" as the key.
Select "Opaque black style" as the value.
EDIT: The comment by #codrut below to choose the value:
If you go far to the right, there's a button that brings you a drop down with the possible options.
The status bar in the nib files is there as an indication, just to simulate the real interface.
What you need to do is:
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackOpaque];
and in the plist change the Status Bar Style (UIStatusBarStyle) to Black opaque (UIStatusBarStyleBlackOpaque) (or whatever you want).
Add the following in the info.plist file
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
Not sure if this will help anyone else, but in our app we ran into an issue where the only way we could get it to use the black style was if we set it to the default style:
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleDefault];
Might be worth giving that a try if BlackOpaque isn't working for you.
Try this simple method....
1.For single viewController
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackOpaque];
2.For whole application
info.plist
----> Status Bar Style
--->UIStatusBarStyle to UIStatusBarStyleBlackOpaque

Hiding status bar completely

I hide the status bar in applicationDidFinishLaunching using
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
That works fine except the status bar is there while the app is loading. Meaning, when the default.png is displayed, I see the status bar. Is there a way to have the status bar not show at all?
Add UIStatusBarHidden to your info.plist file, set to true. Documentation here:
http://developer.apple.com/library/ios/ipad/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html
You need to use this:
[[UIApplication sharedApplication] setStatusBarHidden:YES];
and then open up the info.plist file, create a new line, chose Status bar is initial hidden and set it to true.
You need to edit your Info.plist to include the entry "Status bar is initially hidden" and set the value to YES.
For more information:
http://www.idev101.com/code/User_Interface/StatusBar.html