Swift UINavigationController';当用户在webview中播放视频时,浏览器的导航栏与状态栏重叠

Swift UINavigationController';当用户在webview中播放视频时,浏览器的导航栏与状态栏重叠,swift,uinavigationcontroller,ios11,statusbar,xcode9.2,Swift,Uinavigationcontroller,Ios11,Statusbar,Xcode9.2,我使用的是UINavigationController,工作正常,当我在Webview中播放视频并更改设备方向时出现问题,然后控制器的导航栏与状态栏重叠,屏幕截图已连接。我见过这些解决方案,但这些解决方案在不使用导航控制器时适用,因为我无法更改导航控制器导航栏的属性,有什么建议吗 所以我能够解决这个问题,下面是对我有效的解决方案 open override func viewDidLoad() { super.viewDidLoad() NotificationCenter.de

我使用的是UINavigationController,工作正常,当我在Webview中播放视频并更改设备方向时出现问题,然后控制器的导航栏与状态栏重叠,屏幕截图已连接。我见过这些解决方案,但这些解决方案在不使用导航控制器时适用,因为我无法更改导航控制器导航栏的属性,有什么建议吗

所以我能够解决这个问题,下面是对我有效的解决方案

open override func viewDidLoad() {
    super.viewDidLoad()
    NotificationCenter.default.addObserver(self, selector: #selector(updateStatusBar), name: Notification.Name.UIWindowDidBecomeKey, object: nil)

    NotificationCenter.default.addObserver(self, selector: #selector(updateStatusBar), name: Notification.Name.UIDeviceOrientationDidChange, object: nil)
}

@objc func updateStatusBar() {
    UIApplication.shared.isStatusBarHidden = UIApplication.shared.statusBarOrientation.isLandscape
    setNeedsStatusBarAppearanceUpdate()
}