3
votes

I noticed that the iOS app, Things, has a status bar with grey content (not black, or white) in their iPhone app. I noticed this on an iPhone X. I was under the impression that you could only have a status bar with black or white content by setting the status bar style.

See the attached screenshot for an example.

How would they have achieved this in their app?

Edit: I do not mean the background color of the status bar, I mean the actual color of the text and icons in the status bar.

Things Screenshot with grey statusbar

1

1 Answers

4
votes

Ok, after some more digging I found this comment on StackOverflow.

It does exactly what I was looking for. Looks like it uses some sort of Private API, so probably not the wisest thing to implement in a real app.

Specifically the code that worked for me is found below. Put this code in application(_:didFinishLaunchingWithOptions:) inside your AppDelegate.

Swift 4

if application.responds(to: Selector(("statusBar"))),
    let statusBar = application.value(forKey: "statusBar") as? UIView,
    statusBar.responds(to: #selector(getter: CATextLayer.foregroundColor)) {
        statusBar.setValue(UIColor.gray, forKey: "foregroundColor")
}