Status Bar showing black text, only on iPhone 6 iOS 8 simulator
This bug only occurs if your app is being scaled to fit the resolution of the newer devices.
A quick fix (who knows whether this will even get addressed in 8.1) is to provide the proper resolution loading images in your app package.
From https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen/
For iPhone 7, iPhone 6s, iPhone 6:
750 x 1334 (@2x) for portrait
1334 x 750 (@2x) for landscape
For iPhone 7 Plus, iPhone 6s Plus, iPhone 6 Plus:
1242 x 2208 (@3x) for portrait
2208 x 1242 (@3x) for landscape
In my app, we only support portrait, so providing the 750x1334 and 1242x2208 fixed it.
And just to confirm in case it wasn't obvious, you DO need to be using UIStatusBarStyleLightContent for your status bar style.
Status bar becomes black
I just found a solution. It is a bug which gets solved if the proper splash screens are defined.
Status bar has white text and black icons
I had the same problem. This happened after direct assignment of the root controller and had something to do with the app windows.
let appDelegate = UIApplication.shared.delegate
appDelegate.window?.rootViewController = controller
Any action with the window (showing the keyboard, etc.) fixed everything. My solution was to add makeKeyAndVisible
appDelegate.window?.makeKeyAndVisible()
iPhone 5/SE show white statusbar, iPhone 6/7 show black statusbar
Actually, after finding this:
Status Bar showing black text, only on iPhone 6 iOS 8 simulator
I was able to work it out. I had to put either launch images for the non-working iphone models, or what I now did, use a launch storyboard. Now everything is white statusbar.
Status bar stays black even when set to light
Ok found it.
In plist set "View controller-based status bar appearance" to NO and in appDelegate.swift in func application before return true add following line:
splitViewController.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
View is showing only in status bar in iphone
It was Internet issue. I was using LAN for running this App and the IP was conflicting, so when I update the IP of my iPhone the issue got fixed.
Status Bar Text Color on iPhone XR is different
In iOS 12, setting NO
at View controller-based status bar appearance
in Info.plist
won't work anymore; you must set it to YES
. Your workaround is the recommended way to do so.
Reference: https://stackoverflow.com/a/52443917/188331
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())
Related Topics
How to Open Location Services Screen from Setting Screen
iOS 9 - "Attempt to Delete and Reload the Same Index Path"
iOS - Uiimagewritetosavedphotosalbum
Nsuserdefaults Unreliable in iOS 8
iOS App Deployment Without Appstore
Create a Button Programmatically and Set a Background Image
A Launch Storyboard or Xib Must Be Provided Unless the App Requires Full Screen
How to Add Text Input in Alertview of iOS 8
How to Convert .Dae to .Scn Files in Scenekit
Which Tasks Are More Suitable to Nsoperation Than Gcd
How to Make Sure API Requests Come from Our Mobile (Ios/Android) App
iOS Tesseract Ocr Image Preperation
Xcode 8, iOS 10 - "Starting Webfilter Logging for Process"
Adding Multiple Arrays to Form One Final Array. Debug Swift Xcode