【发布时间】:2018-02-12 08:48:16
【问题描述】:
在 iOS 11 中,我遇到了状态栏显示/隐藏的问题。 但它只是在我更改颜色状态栏时发生
UIApplication.shared.statusBarStyle = .lightContent
let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView
if statusBar.responds(to: #selector(setter: UIView.backgroundColor)) {
statusBar.backgroundColor = UIColor.black
}
我有两个屏幕。屏幕 1 显示黑色状态栏,屏幕 2 隐藏黑色状态栏。返回屏幕 1 时,状态栏会闪烁。
我将我的示例上传到 Github: https://github.com/phungtai/StatusBar.git
注意:
- 仅限 iOS 11.xx.xx
- 更改颜色状态栏时发生,保持默认不会发生。
https://media.giphy.com/media/l3dj1EXWwic3oP6KY/giphy.gif
【问题讨论】: