乐趣区

关于ios:wkwebview横屏播放后状态栏异常问题解决

WkWebview 横屏全屏播放当前,回到竖屏状态会导致状态栏异样。与这个问题相似:https://stackoverflow.com/que…

解决方案也是如此。写下 oc 的解决办法:

// 横屏状态下暗藏状态栏,保障视频能够全屏播放
- (BOOL)prefersStatusBarHidden {return UIApplication.sharedApplication.statusBarOrientation == UIInterfaceOrientationLandscapeLeft || UIApplication.sharedApplication.statusBarOrientation == UIInterfaceOrientationLandscapeRight;}
// 放到 viewDidLoad 办法外面监听屏幕的变动
[[NSNotificationCenter defaultCenter] addObserver:self
                                                     selector:@selector(handleDeviceOrientationDidChange)
                                                         name:UIDeviceOrientationDidChangeNotification
                                                       object:nil];
// 刷新 statusbar 的暗藏状态,当屏幕地位发生变化的时候
- (void)handleDeviceOrientationDidChange {[self setNeedsStatusBarAppearanceUpdate];
}
退出移动版