Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Status bar not the same color as the Navigation Bar

I have a Navigation Controller, where I am coloring my navigation bar with some color, and I want the status bar (which shows the carrier, wifi symbol, etc) to use the same color.

So in Info.plist, I have set View controller-based status bar appearance equal to NO. And in the Target > Deployment Info I set the Status Bar Style > Light:

enter image description here

I can see that the status bar is now indeed using the "light" style as the text is light/white. But the status bar background is still not the same as the Navigation bar as seen below. How can I correct this?

enter image description here

like image 478
rgamber Avatar asked Oct 22 '17 18:10

rgamber


People also ask

How to change StatusBar color on Android devices?

Now, you can change the statusbar color after turning on the settings. Just tap on the color palate and select a color according to your choice. This is also possible to change the status bar icon color. For that, just select Statusbar icon color and select a color. That’s it. In this way, you can change the status bar color of your Android device.

Is it possible to change the style of the status bar?

:' ( According to the react-native Statusbar docs it is possible to change the style (and background color) of the status bar: But in react-native-navbar it seems that only the iOS status bar is being styled:

How to change status bar color in React Native?

If you are using Expo for React Native then here is the solution for setting Android Status Bar Color. And then Go to Your Main Component or App.js, import 'StatusBar' from 'react-native'. Then add Following Code in return: Here, we are setting the status bar color as Black but with 0.2 opacity.

What is status bar on Android devices?

That is Status Bar, where you can look at network status, battery level, time and sometimes date too. Nonetheless, the navigation bar or soft menu bar isn’t positioned on all Android devices. Although, you can get that on most of the Android devices but sometimes, that could create some issues likewise.


1 Answers

You have to use like this :

if let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as? UIView {
    statusBar.backgroundColor = UIColor.purple
}

If you want to change the status bar color all over the app, use it in appdelegate->didFinishLaunchingWithOptions. Or if you want to change for any particular screen, then call it in the particular viewDidLoad.

like image 168
Vini App Avatar answered Sep 27 '22 22:09

Vini App