Changing the status bar text color in splash screen iOS 7
In the project plist file add the "Status Bar Style" property (key is UIStatusBarStyle
). Then ignore all the possible values listed in the drop down for this property and type UIStatusBarStyleLightContent
instead.
And you don't have to set UIViewControllerBasedStatusBarAppearance
to NO
in your plist, you can set the preferredStatusBarStyle
you want to your view controllers.
How to set launch screen status bar color to white?
For that you have to change Status Bar Style to Light from "General" tab under project target.
How to set in the entire app
Above only change the status bar color of launch screen to white & rest of controller have black color. If you wanted to change the entire project status bar color to white then add below too :
On you project plist file:
- Status bar style:
UIStatusBarStyleLightContent
- View controller-based status bar appearance:
NO
- Status bar is initially hidden:
NO
UIStatusBar color change to white when Splash screen showing
It has option to select light.
How to change Status Bar text color in iOS
Set the
UIViewControllerBasedStatusBarAppearance
toYES
in the .plist file.In the
viewDidLoad
do a[self setNeedsStatusBarAppearanceUpdate];
Add the following method:
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
Note: This does not work for controllers inside UINavigationController
, please see Tyson's comment below :)
Swift 3 - This will work controllers inside UINavigationController
. Add this code inside your controller.
// Preferred status bar style lightContent to use on dark background.
// Swift 3
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
Swift 5 and SwiftUI
For SwiftUI create a new swift file called HostingController.swift
import Foundation
import UIKit
import SwiftUI
class HostingController: UIHostingController<ContentView> {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
}
Then change the following lines of code in the SceneDelegate.swift
window.rootViewController = UIHostingController(rootView: ContentView())
to
window.rootViewController = HostingController(rootView: ContentView())
How to change Status Bar text color in iOS
Set the
UIViewControllerBasedStatusBarAppearance
toYES
in the .plist file.In the
viewDidLoad
do a[self setNeedsStatusBarAppearanceUpdate];
Add the following method:
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
Note: This does not work for controllers inside UINavigationController
, please see Tyson's comment below :)
Swift 3 - This will work controllers inside UINavigationController
. Add this code inside your controller.
// Preferred status bar style lightContent to use on dark background.
// Swift 3
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
Swift 5 and SwiftUI
For SwiftUI create a new swift file called HostingController.swift
import Foundation
import UIKit
import SwiftUI
class HostingController: UIHostingController<ContentView> {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
}
Then change the following lines of code in the SceneDelegate.swift
window.rootViewController = UIHostingController(rootView: ContentView())
to
window.rootViewController = HostingController(rootView: ContentView())
Change status bar text colour from white iOS 7 / Xcode 5
I just fixed this issue in one of my apps. Implement this in your UIViewController:
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
Or choose another UIStatusBarStyle
value that you need.
How to change the color for the status bar and the swipe bar section?
My question already was answered by the sample on link above: setting .Background of the parent UIElement is sufficient
How to change status bar color of native splash screen in flutter?
Solved by adding below code in values/styles.xml and values-night/styles.xml in res folder:
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowLightStatusBar">true</item>
</style>
Related Topics
Swift - How to Get Last Taken 3 Photos from Photo Library
How to Get Selected Value from Uipickerview
How to Check If a Uialertcontroller Is Already Presenting
Change Uidatepicker Font Color
How to Add My App to the Share Sheet Action
Perform Push Segue After an Unwind Segue
iOS in App Purchase: Test a Real Purchase Without Submitting to Apple
Dynamic Uitableview Cell Height Based on Contents
Can a Standard Accessory View Be in a Different Position Within a Uitableviewcell
Stretch Background Image for Uibutton
"Initialize" Class Method for Classes in Swift
Reading Long Characteristic Values Using Corebluetooth
How to Select Range of Values When Using Arc4Random()
Sudzc Arc Version - Objc_Msgsend Call Causes Exc_Bad_Access Using 64-Bit Architecture
Can't Install Watchkit App on Apple Watch
Will iOS Wake Up the Terminated App If It's Registered with Location for Uibackgroundmodes