与此类似: How to make a Navigation Bar and Status Bar blurred (UIBlurEffect)? iOS, Swift 3
但我们只想在 StatusBar 上应用 UIBlurEffect,而不是在导航栏上。这可能吗?
最佳答案
你可以通过下面的代码得到你的状态栏 View ,然后尝试添加到视觉效果,如here
let statWindow = UIApplication.shared.value(forKey:"statusBarWindow") as! UIView
let statusBar = statWindow.subviews[0] as UIView
// statusBar.backgroundColor = UIColor(red: 23 / 255.0, green: 0 / 255.0, blue: 154 / 255.0, alpha: 0.7)
statusBar.backgroundColor = UIColor(red: 213 / 255.0, green: 0 / 255.0, blue: 0 / 255.0, alpha: 0.7)
关于ios - UIBlurEffect 仅在 StatusBar 上(不在 UINavigationBar 上),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44947818/