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.
Related
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;
}
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.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Hide the status bar on iPhone on a single view?
I want to hide the title bar in iphone from my first welcome view and also from the splash screen, how can i hide it(top bar, not the navigation bar).
I saw a post with this
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
but this hides the title bar through out the application. I just want to hide it from the first view.
The easiest way to hide the status bar is to go into youInfo.plist; right click to add a row and select Status Bar Initially hidden.
This will ensure every time you app launches the status bar will be hidden.
Edit
with programming
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
self.navigationController.navigationBar.frame = CGRectMake(0, 0, 320, 44);
and when you want to show the statusbar just use bellow code..
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
self.navigationController.navigationBar.frame = CGRectMake(0, 45, 320, 44);
i hope this help you...
:)
In AppDelegate class applicationDidFinishLaunching ,write the below code
- (void) applicationDidFinishLaunching:(UIApplication *)application
{
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
}
All other views (except first View) when you need to display StatusBar, write the below code in curresponding ViewDidiLoad() / viewWillAppear,
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
in your info.pist find this option.
"Status bar is initially hidden" And set as YES.
Depends which version of Xcode you are using.
In 4.5 you can go into the build settings "Summary" tab and set this in the "Status Bar" section.
If you don't have 4.5 then in the build settings "Info" section add a plist entry for "Status Bar Is Initially Hidden" and set it to YES. (Alternatively, download Xcode 4.5 because you should do this anyway).
I have the following code:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
Anything I put behind the status bar, including a background color, can't be seen however. And when i do this, it just leaves a black background behind where it was:
[UIApplication sharedApplication].statusBarHidden = YES;
Any ideas why this might be happening?
Have you tried setting the status bar to hidden in the application's info.plist? Does that make a difference?
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