Changing status bar color for individual ViewControllers in iOS 8 on Swift
Hi everyone! I'm new to Swift and iOS development. I'm writing an app that should support iOS 8. I've encountered a problem: I need the status bar text color (at the top of the screen, where the time, battery charge, etc. are displayed) to be different on different screens. For example, on the main screen with a white background, the text should be black, and on a screen with a dark background, it should be white.\n\nI've already tried setting `UIApplication.shared.statusBarStyle = .lightContent` in `viewDidLoad`, but this changes the color for the entire app, not for a specific controller. Also, Xcode gives a warning that this method is deprecated in iOS 9 and above.\n\nI've read that I need to override the `preferredStatusBarStyle` method in my ViewController, but I can't get it to work. Here's my code:\n\n```swift\nclass MyViewController: U
No answers yet.
Log in to leave an answer
Blogs