I\'m trying to detect hidden and show of iPhone\'s UIStatusBar but failed. Are there any solution can help me, like KVO or something else?
From iOS 11 and up you can subclass the UIView of the view controller and override safeAreaInsetsDidChange
:
override func safeAreaInsetsDidChange() {
super.safeAreaInsetsDidChange()
// adapt your view
}
Your view must share the top rect with the status bar for this to work. (But if it doesn't, you probably wouldn't need to detect changes anyway).