2

I am trying to make my status bar the same color as my navigation bar, and not the same color as my background. I haven't found any solutions that work with iOS 12 Objective-C and aren't going to get my app banned from the app store.

This is how I'm setting up the Nav Bar:

[navController setBarTintColor:[UIColor colorWithRed:0.26 green:0.53 blue:0.96 alpha:1.0]];
[navController setTranslucent:FALSE];
[navController setBarStyle:UIBarStyleBlack];
[navController setTintColor:[UIColor whiteColor]];

And I've tried View controller-based status bar appearance as both YES and NO, neither making a difference.

EDIT: The current behavior: status bar is the same color as the view's background. I'm trying to have it the same color as the navigation bar background.

enter image description here

I changed the background to red to show what I'm talking about. In this case, I'd like to make the status bar (or anything above the nav bar) blue, the same color as the nav bar.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • What problem are you facing? I am able to set the color of my status bar same as my navigation bar by using above piece of code in both ios 11 and 12. – HAK Dec 31 '18 at 04:38
  • i think you are asking about changing status bar color which shows network signal bar and in ios it having two color light and dark –  Dec 31 '18 at 05:01
  • @iOSTeam The current behavior: status bar is the same color as the view's background. I'm trying to have it the same color as the navigation bar background. – Oliver Leopold Dec 31 '18 at 15:22

1 Answers1

0

In iOS 12 the status bar has no color. It has white or black text and its background is clear (transparent).

If the navigation bar is correctly configured, it appears behind the status bar and so they are the same apparent color. But your navigation bar (or whatever the "Available Jobs" thing is) is not correctly configured; its top stops too early (too low), so your red view is visible behind it.

What you see should look more like this:

enter image description here

That is a table view in a navigation controller in a tab view controller. So what you have must be some other arrangement, but you have not explained what it is.

For example if you have a “loose” navigation bar follow my instructions here: https://stackoverflow.com/a/30831452/341994. That is for a toolbar but it works the same way.

But using a navigation controller is easier and better even if you will never do any navigation!

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Can you go over the proper configuration? What is wrong with mine above? – Oliver Leopold Dec 31 '18 at 15:19
  • The current behavior: status bar is the same color as the view's background. I'm trying to have it the same color as the navigation bar background. – Oliver Leopold Dec 31 '18 at 15:22
  • I told you, the status bar has no color. If you are seeing the view behind the status bar, then something is wrong with your navigation bar or navigation controller’s size. – matt Dec 31 '18 at 16:10
  • You have not shown any screen shots so no one knows even what the “problem” is. – matt Dec 31 '18 at 16:13
  • You're right, I'm sorry. I updated the question with a link to a picture, and there's a description below. Thanks for any help and I'm sorry that I'm having trouble communicating. – Oliver Leopold Dec 31 '18 at 20:28
  • Well, that is exactly what I said in my answer and in my previous comment. Something is wrong with your navigation bar. It is supposed to extend _up behind_ the status bar. But it isn't. So you are doing something wrong with your navigation controller or navigation bar. – matt Dec 31 '18 at 20:32
  • I can't help much more because you have not explained what we are seeing: is it a table view in a nav controller, or something else? Is it contained in anything else? (Looks like it might be in a tab bar controller.) What is the "Available Jobs" bar - is it the navigation bar of the nav controller, or is it a loose nav bar, or is it part of the table? – matt Dec 31 '18 at 20:38
  • It is a dynamic Table View inside of a Tab Bar Controller. What says "Available Jobs" is a loose Navigation Bar. – Oliver Leopold Dec 31 '18 at 21:13
  • Ok! So a loose navigation bar is not like a navigation bar in a navigation controller. You have no navigation controller? – matt Dec 31 '18 at 21:39
  • But using a navigation controller is much easier. – matt Dec 31 '18 at 21:49