Created
April 5, 2021 04:27
-
-
Save LovaRK/b92836082548aad0d312ebca34a30e78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIViewController { | |
func statusBarColorChange() { | |
if #available(iOS 13.0, *) { | |
let app = UIApplication.shared | |
let statusBarHeight: CGFloat = app.statusBarFrame.size.height | |
let statusbarView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: statusBarHeight)) | |
statusbarView.backgroundColor = UIColor.red | |
view.addSubview(statusbarView) | |
} else { | |
let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView | |
statusBar?.backgroundColor = UIColor.red | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment