I set an UINavigationBar background tint by appearance using macro color:
[[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x6DBEE8)];
And in whole navigation based application but in my UIModalViewController does not work:
In my plist i have : View controller-based status bar appearance : YES
and globally i set appearance : [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Here it what it's look like:
That is because in iOS7, the height of UINavigationBar is increased (64 points) when it is contained in a UINavigationController. With the status bar being transparent,when you are presenting a view controller modally, its not in the UINavigationController so the height is normal (44 points) and thus the map view is behind the status bar. You need to handle this in your modal view controller. You can:
Hide the status bar altogether (works but might not be preferable in
every situation)
Put a view behind the navigation bar and where the status bar is with
the same background color.
Change the color of the view controller's view itself to the desired color and
offset the y position of your map view to accommodate the status
bar's height.
Related
I would like to change the status bar text (the text at the top of the screen with the time, battery percentage, etc) to white. How can I do this?
If your view controller is within a navigation controller, in the view controller's .m , use this line in your viewDidLoad:
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
I have a navigation view controller. The root view hides the navigation bar using self.navigationController?.navigationBarHidden = true.
No matter what I do I cannot get thestatusBar to be translucent it is simply a white block that pushes my content below.
You can make status bar translucent as -
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
// set full screen layout in view controller class
self.wantsFullScreenLayout = YES;
In my project I've integrated the SWRevealViewController, and while I was setting it up I noticed that one of my view controllers - managed by a UINavigationController - had a black status bar even though the background color of the view controller is white. How can I change the Status Bar color back to white? (Either programmatically or in the Interface Builder)
If below the status bar is a navigation bar, the status bar style will be adjusted to match the navigation bar style (UINavigationBar.barStyle):
Specifically, if the navigation bar style is UIBarStyleDefault, the status bar style will be UIStatusBarStyleDefault; if the navigation bar style is UIBarStyleBlack, the status bar style will be UIStatusBarStyleLightContent.
So in your case as status bar is black,
If you want UIStatusBarStyleLightContent on a UINavigationController use:
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
Also you can refer: preferredStatusBarStyle isn't called
How can I hide the navigation bar by not hiding the status bar in my app? When I try [self.navigationController.navigationBar setHidden:YES]; it also hides the status bar. I need to show the status bar like this:
I need to first hide a visible navigation bar, make the status bar still visible and I also have a view that I need to move below the status bar, but the view is being positioned like the navigation bar is still there when I set the frame's position to 0,0.
I setup my statusbar as:
[[UIApplication sharedApplication] setStatusBarHidden:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Add this to your code where you want to hide the navigation bar
[self.navigationController.navigationBar setHidden:YES];
If you want to hide navigation bar but show status bar, you should set Top Space to Top Layout Guide as 0 instead of -44. and then
Hide navigation bar in viewWillAppear instead of viewDidLoad: [self.navigationController setNavigationBarHidden:YES animated:YES]
I start to set top space as -44, then call method [[UIApplication sharedApplication] setStatusBarHidden:NO], it doesn't work.
In my case, the status bar text and symbols were not shown because they had the same color as the background (black). I solved the problem by changing the background color:
[self.navigationController.navigationBar.superview setBackgroundColor:UIColor.whiteColor];
I've uinavigationcontroller and within uiviewcontroller. Now my navigationbarhidden = yes.
But when I hide the navigation bar then changed the color of the status bar.
I want to change the color of the status bar as color of the hidden navigation bar.
I did so :
I haven`t used navigation controller anywhere as shown in the picture. This is just hack way in iOS6, but it only changed color for views which are not in a navigation controller. For me though, solution is important only in iOS6
Any idea?
Change StatusBar color
For Hide navigationBar
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
As has been answered in this post:
In your "Project Summary", in "Status Bar", set "Style" and "Tinting" to "Default.
Then, jump into you xib or storyboard and add a UINavigationBar just bellow the status bar.
Set the UINavigationBar "Style" to "Default" and select the "Tinting" of your choice.
Run! :-)
If you don't want any UINavigationBar visible in your Interface, all you want to do is putting the UINavigationBar behind all the Objects, or set the "Alpha" to zero.