How to set Status Bar Style in Swift 3

[UPDATED] For Xcode 10+ & Swift 4.2+ This is the preferred method for iOS 7 and higher In your application’s Info.plist, set View controller-based status bar appearance to YES. Override preferredStatusBarStyle (Apple docs) in each of your view controllers. For example: override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } If you have preferredStatusBarStyle returning a … Read more

How to change the status bar background color and text color on iOS 7?

Warning: It does not work anymore with iOS 13 and Xcode 11. ======================================================================== I had to try look for other ways. Which does not involve addSubview on window. Because I am moving up the window when keyboard is presented. Objective-C – (void)setStatusBarBackgroundColor:(UIColor *)color { UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@”statusBarWindow”] valueForKey:@”statusBar”]; if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) { … Read more

tech